Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 Redirect index.html



3:36 pm on Nov 20, 2006 (gmt 0)

5+ Year Member


Somewhere I must've linked to /index.html and the SEs have indexed both www.mydomain.com and www.mydomain.com/index.html

I have seen some other posts with similar examples using mod rewrite which just goes way over my head.

I would like to setup a simple 301 redirect in .htaccess as such:

redirect 301 /index.html [mydomain.com...]

Would this be the simplest and best way to accomplish?

Dabu The Dragon

3:48 pm on Nov 20, 2006 (gmt 0)

10+ Year Member

I think what you are saying is that you want the SE's to only give results for "/" only. If this is the case, then do your best to have inbound links reflect this.


3:49 pm on Nov 20, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

You'll likely end up with an endless loop with that code.

This subject was covered in this recent thread [webmasterworld.com].



3:51 pm on Nov 20, 2006 (gmt 0)

5+ Year Member

That is correct.

Also looking to avoid duplicate content since both URLs are indexed.

Is a simple 301 as listed above the best way to go?


3:59 pm on Nov 20, 2006 (gmt 0)

5+ Year Member

Thank you very much jd.
I have reviewed the thread.

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

This will solve the problem of both URLs being indexed correct?

Also there is some other "mod rewrite" code within my .htaccess will the addition of this code effect it at all?

This goes way over my head, so I best paste the code here (which btw I have no idea what it does, and can see errors in my error log)

Options +FollowSymlinks

RewriteEngine On

RewriteCond %{HTTP_HOST}!^www
RewriteRule (.*) [%{HTTP_HOST}...] [L,R=301]

Thanks again for your time>


Featured Threads

Hot Threads This Week

Hot Threads This Month