Does this .htaccess file contain errors?

Avatar
  • Answered
DirectoryIndex index.php ErrorDocument 404 /404.php order allow,deny deny from 212.174.63.150 deny from 41.143.204.175 allow from all # Enable expirations ExpiresActive On # Default directive ExpiresDefault "access plus 1 month" # My favicon ExpiresByType image/x-icon "access plus 1 year" # Images ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpg "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" # CSS ExpiresByType text/css "access plus 1 month" # Javascript ExpiresByType application/javascript "access plus 1 year" RewriteEngine on # START forcing www. RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301] # END forcing www. # Prevents abuse of Cookies # RewriteCond %{HTTP_COOKIE} ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC] # Prevents URLs with Forbidden Characters # RewriteEngine On RewriteCond %{REQUEST_URI} ^.*(,|;|:|<|>|">|"<|\.\.\.).* [NC,OR] RewriteCond %{REQUEST_URI} ^.*(\=|\@|\[|\]|\^|\`|\{|\}|\~).* [NC,OR] RewriteCond %{REQUEST_URI} ^.*(\'|%0A|%0D|%27|%3C|%3E|%00).* [NC] # Blacklist via the Query String # RewriteCond %{QUERY_STRING} ^.*(localhost|loopback|127\.0\.0\.1).* [NC,OR] RewriteCond %{QUERY_STRING} ^.*(\.|\*|;|<|>|'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).* [NC,OR] RewriteCond %{QUERY_STRING} ^.*(md5|benchmark|union|select|insert|cast|set|declare|drop|update).* [NC] RewriteRule ^(.*)$ - [F,L] # Prevent Hotlinking to Images # #RewriteCond %{HTTP_REFERER} !^$ #RewriteCond %{HTTP_REFERER} !^http://(www\.)? myexample/.*$ [NC] #RewriteRule \.(jpg|jpeg|gif|png|bmp)$ - [F] # Redirect .net and .org to .com # RewriteCond %{HTTP_HOST} ^www\. myexample\.net$ RewriteCond %{HTTP_HOST} ^www\. myexample\.org$ RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^/?$ "http\:\/\/www\.myexample\.com\/" [R=301,L]
Avatar
johnpaulb-imhs1
Hello,

Thank you for your question regarding .htaccess errors. We are happy to help you troubleshoot your .htaccess file but will need some additional information to test further.

What problems are you experiencing?

Can you provide a link to the site for us to test?

What are you trying to accomplish with your .htaccess rules?

Thank you,
John-Paul