Apache .htaccess Guide, Tutorials and Articles

Apache .htaccess Guide & Tutorial >>

Preventing requests with invalid characters

If you wish, you can use Mod_Rewrite to deny requests containing invalid characters, please be aware that with certain site setups this may break links.
 
To enable this, create a .htaccess file following the main instructions and guidance, and include the following text:
 

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

Next Article: Useful Resources
Previous Article: Setting up Associations for Encoded Files

Post Comment

Your Name:
Your Comment: