Forum Moderators: phranque
I have tried with .htaccess:
Redirect permanent /dir/ [domain.com...] but this cause a infinity loop.
My server don't support RewriteRule but only Mod_alias. So I think that is possible with RedirectMatch. It is correct?
RedirectMatch permanent ^/dir/$ [domain.com...]
Thank you in advance for your suggestion.
A partial solution is to change the DirectoryIndex page (for example, to index.htm), and to rename that file. This avoids the looping problem, but requires the filename to be changed. Also, it will only 'fix' search engine listings if you do not link to /index.htm on your own site; You must always refer (link) to that page only as "/".
Jim
I have a lot of inbound link to www.domain.com/dir/ (PR 4) and a lot to www.domain.com/dir/index.htm (PR 5)
All internal link point at www.domain.com and www.domain.com/dir/index.htm (not any at www.domain.com/dir/ )
So I ask that it is correct for only "fix" search engine listings and possible duplicate content:
RedirectMatch permanent ^/dir/$ [domain.com...]
Thanks a lot for more suggestion
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html?\ HTTP/ [NC]
RewriteRule ^(.*)index.html?$ http://www.example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
This redirects both index.htm and index.html to "/" and the redirect preserves any folder names in the redirect path too.
Even better, If you ever change to index.php or something else, none of your existing links will be broken as the real name of the index file is never revealed in the internal linking.
RedirectMatch permanent ^/dir/$ [domain.com...]