Forum Moderators: phranque
[edited by: phranque at 1:00 pm (utc) on Apr 20, 2013]
[edit reason] unlinked urls [/edit]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.htm\ HTTP/
RewriteRule ^(([^/]+/)*)index\.htm$ http://www.%{ENV:HTTP_DOMAIN}/$1 [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} !(403|404)
RewriteCond %{HTTP_HOST} !^w{3}\. [NC]
RewriteRule (.*) http://www.%{ENV:HTTP_DOMAIN}/$1 [R=301,L]
i'm not sure why you need the RewriteCond in that ruleset.
For a while I have been using a separate domain for final checking and I 403 everyone exept myself on the test domain.
!^(www\.example\.com)?$ 500 response
RewriteCond %{HTTP_HOST} ^w{3}\. [NC]
RewriteCond %{HTTP_HOST} !^(www\.%{ENV:HTTP_DOMAIN})?$ [NC] RewriteCond %{ENV:REDIRECT_STATUS} !(403|404)
RewriteCond %{HTTP_HOST} !^w{3}\. [NC]
RewriteRule (.*) http://www.%{ENV:HTTP_DOMAIN}/$1 [R=301,L]
-------------------------------------------------------
The 403|404 RewriteCond is to prevent the redirect.
when I tried using
RewriteCond %{HTTP_HOST} !^(www\.%{ENV:HTTP_DOMAIN})?$ [NC]
I got an infinite loop.
The deny/allow is the first thing I do as you can see in the OP.