I want to redirect non www to www and index.html to root but it is not working, I have used the following code but when I type http://example.com/about-us.html it redirects to http://www.example.com/
html/about-us.html
Why it adds HTML in the url Here is the code RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]
[edited by: aakk9999 at 5:33 pm (utc) on Feb 21, 2014]
[edit reason] Please use example.com to avoid autolinking [/edit]