/ Published in: Apache

Good .htaccess file to start with.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
RewriteEngine On # strip out querystrings for bots RewriteCond %{HTTP_USER_AGENT} Google [NC,OR] RewriteCond %{HTTP_USER_AGENT} MSNBot [NC,OR] RewriteCond %{HTTP_USER_AGENT} Slurp [NC] RewriteCond %{QUERY_STRING} . RewriteRule ^(.*)$ /$1? [L,R=301] # rewrite second level to third level RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule .? http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] # rewrite index.html to root RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/ RewriteRule ^(.*)index\.html$ /$1 [R=301,L] #Define friendly 404 page ErrorDocument 404 /404.html
Comments
