Forum Moderators: phranque
RewriteEngine on
rewritecond %{http_host} ^mydomain,com [nc]
rewriterule ^(.*)$ [www(dot...] )mydomain,com/$1 [r=301,nc]
This works fine except for I need to add to it so when index.html is entered I want it to go to http:// www . mydomain . com/
Any help would be appreciated.
I almost have it
This works
RewriteEngine on
rewritecond %{http_host} ^mydomain.com [nc]
rewriterule ^(.*)$ [mydomain.com...] [r=301,nc]
But this doesnt
RewriteEngine on
rewritecond %{http_host} ^mydomain.com [nc]
rewriterule ^(.*)$ [mydomain.com...] [r=301,nc]
rewritecond $1 ^index.html [nc]
rewriterule ^(.*)$ [mydomain.com$1...] [r=301, L]
Any ideas I can make these live in harmony?
Also, do not feel free to deviate in format or casing from the mod_rewrite directive and variable documentation; Doing so may cause problems on some hosts, and it is just not worth the risk.
You will also need to reverse your rules to avoid a double redirect if index.html is requested from a non-canonical domain, and if this code goes into .htaccess, there is a slash missing in your substitution URL.
Jim