wheelie34

msg:3881572 | 10:48 am on Mar 30, 2009 (gmt 0) |
Hi ponchaz and welcome to the forum Try this after what you already have RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html RewriteRule (.*) http://www.example.com/ [R=301,L] HTH
|
ponchaz

msg:3881592 | 11:24 am on Mar 30, 2009 (gmt 0) |
That did it! Thanks so much Wheelie!
|
g1smd

msg:3881708 | 3:13 pm on Mar 30, 2009 (gmt 0) |
Wait. There are multiple problems with that. First. That code only works for the single index file located in the site root. You should fix this for all folders at any level. There's example code posted in many prior threads. Second. If you place this redirect after your non-www to www redirect then you create an unwanted redirection chain for a non-www request that contains the index filename. To fix this, use the example code posted in earlier threads, and place that code before the general non-www to www redirect. Be aware that your non-www to www redirect code can be improved in several subtle ways too. Several prior threads discuss the reasons.
|
jdMorgan

msg:3881806 | 5:37 pm on Mar 30, 2009 (gmt 0) |
# Externally redirect requests for index.html in any directory to "/" in that directory RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/ RewriteRule ^(([^/]+/)*)index\.html$ http://www.example.com/$1 [R=301,L] # # Externally redirect requests for *all* non-canonical hostnames to canonical hostname, # including case errors and appended FQDN indicator and/or port numbers. RewriteCond %{HTTP_HOST} !^www\.example\.com$ RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Jim
|
g1smd

msg:3881856 | 6:37 pm on Mar 30, 2009 (gmt 0) |
That's the one!
|
g1smd

msg:3884443 | 12:09 am on Apr 3, 2009 (gmt 0) |
That's the one! However, I usually replace the \.html part with something like \.(s?html?¦php[45]?¦[aj]spx?¦cfm) to make it more universal.
|
jdMorgan

msg:3884478 | 1:35 am on Apr 3, 2009 (gmt 0) |
A balance would likely be best: I'd recommend redirecting only index.xyz URLs that actually exist on your site, or that have existed on your site in the past and still have inbound links. Jim
|
|