Forum Moderators: phranque
[size=2]Options +FollowSymLinks
RewriteEngine On
# redirect index.htm and index.html to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html?\ HTTP/
RewriteRule ^(.*)index\.html?$ http://www.mydomain.com/$1 [R=301,L]
# redirect no-www to www.
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L][/size]
There must be some other rule elsewhere that conflicts.
Do we need this line?
RewriteRule !index\.html? - [S=2]
Do we need this line?
RewriteRule !index\.html? - [S=2]
Now that you guys are here
Do we need this line?
RewriteRule !index\.html? - [S=2]
Heh. I just commented on the [S=2] flag in That Other Thread. Helen, be absolutely sure you understand what it does.
# 301 permanent redirect index.html(htm) to folder with exclusion for addon domains
RewriteCond %{HTTP_HOST} !(example\.com|example\.com|example\.com|example\.com|example\.com|example\.com)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]
# 301 permanent redirect non-www (non-canonical) to www with exclusion for addon domains
RewriteCond %{HTTP_HOST} !(example\.com|example\.com|example\.com|example\.com|example\.com|example\.com)
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
But now I'm getting into the domain biz and need to host many domains. Each time I add a domain
To stip off index.html, this seems to do the trick.
RewriteRule ^(.*/)?index\.html?$ /$1 [R=301,L]
And to add "www", this should work.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
Neither of these hardcode any domain name, so it shouldn't matter whether you access your site through an addon domain.