Menu Close

How to Prevent Requests with Invalid Characters Using htaccess file

You can use Mod_Rewrite to deny requests containing invalid characters,

RewriteEngine On 
RewriteBase / 
RewriteCond %{THE_REQUEST} !^[A-Z]{3,9}\ [a-zA-Z0-9\.\+_/\-\?\=\&]+\ HTTP/ [NC] 
RewriteRule .* - [F,NS,L] 

You can also Employ Basic URL Spelling Check to auto-correct simple spelling errors in the URL.

# automatically corect simple speling erors
<IfModule mod_speling.c>
 CheckSpelling On
</IfModule>

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

See also  Stop to Browsing of Directory By Htaccess File and Cpanel