Forum Moderators: phranque
I've got a page at /folder/ that everyone links to. The problem is they don't link to the /folder/index.html.
And google indexes both..Possible dupe content issue!
So I tried doing a standard 301:
redirect 301 /folder/index.html [mysite.com...]
And I get an error saying that it's in an infinite loop.
Is there another way to do this?
You could do this with:
RedirectMatch 301 ^/folder/$ http://www.example.com/folder/index.html
DirectoryIndex index.html
#
# Redirect all <subdirectory>/index.html requests to <subdirectory>/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*/index\.html\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html$ http://www.example.com/$1 [R=301,L]
[edited by: jdMorgan at 8:28 pm (utc) on Mar. 6, 2007]
The actual file extension is .php, so I changed all the .html reference in your code to .php.
And, sadly, it didn't work. Nothing changed. I checked the headers too, and they just return 200 on the index.php file.
Is there another option? Or maybe something different that needs to be done if applying it to a .php?
I tried:
Options -MultiViews
DirectoryIndex index.php
#
# Redirect all <subdirectory>/index.html requests to <subdirectory>/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*/index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]
And it still doesn't seem to change anything. Headers still remain the same.
Plan C? :)