homepage Welcome to WebmasterWorld Guest from 23.22.59.252
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
301 Redirect index.html
ryanwassi

5+ Year Member



 
Msg#: 3162521 posted 3:36 pm on Nov 20, 2006 (gmt 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?

 

Dabu The Dragon

10+ Year Member



 
Msg#: 3162521 posted 3:48 pm on Nov 20, 2006 (gmt 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.

jdMorgan

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



 
Msg#: 3162521 posted 3:49 pm on Nov 20, 2006 (gmt 0)

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

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

Jim

ryanwassi

5+ Year Member



 
Msg#: 3162521 posted 3:51 pm on Nov 20, 2006 (gmt 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?

ryanwassi

5+ Year Member



 
Msg#: 3162521 posted 3:59 pm on Nov 20, 2006 (gmt 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>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved