Forum Moderators: phranque
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html?|php)\ HTTP/
RewriteRule ^(([^/]+/)*)index.(html?|php)$ http://www.example.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
mod_rewrite cannot "get rid of" anything. mod_rewrite is to use the RegEx pattern matching such that one rule matches the current request and rewrites that request to fetch content from elsewhere inside the server. mod_rewrite translates or "rewrites" an incoming URL request into a non-default internal server location, as compared to that suggested by the path part of the requested URL. RewriteRule ^([^/.]+)$ /$1.html [L] mod_rewrite does. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/.])+\.html?(\?[^\ ]+)?\ HTTP/
RewriteRule ^([^/.]+)\.html?$ http://www.example.com/$1? [R=301,L]