Welcome to WebmasterWorld Guest from 54.224.41.46

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 Redirect index.html

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

New User

10+ Year Member

joined:June 7, 2006
posts:13
votes: 0


Hi,

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?

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

Junior Member

10+ Year Member

joined:Dec 13, 2003
posts:109
votes: 0


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)

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 0


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

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

Jim

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

New User

10+ Year Member

joined:June 7, 2006
posts: 13
votes: 0


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)

New User

10+ Year Member

joined:June 7, 2006
posts: 13
votes: 0


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>

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members