Forum Moderators: phranque

Message Too Old, No Replies

Redirecting to root

index, default, home, others

         

crobb305

8:44 pm on Mar 30, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am modifying my htaccess to force other filenames to the root. Until today, I only specified 'index' but I now see attempts to request 'home.html' and 'default.html'. This is what I have, and I wanted to run it by the experts to make sure I haven't left anything off. I fear new variants will appear, so if you can think of anything else, it would be a big help.

OLD Version
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]

NEW Version
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default|home)\.html?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default|home)\.html?$ http://www.example.com/$1 [R=301,L]

g1smd

8:48 pm on Mar 30, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I replace
html?
with
(php[45]?|s?html?|[ja]spx?)
here.

crobb305

8:57 pm on Mar 30, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hmm. I tried that and it generated a 500.