Forum Moderators: open

Message Too Old, No Replies

301 Redirect - For the Experts

         

LongView

12:40 am on Apr 24, 2007 (gmt 0)

10+ Year Member



This is a bit nitpicky but I want to be safe:

I am using the .htaccess 301 redirect.

www.domain.com/subdir
www.domain.com/subdir/index.htm

Both are the same.

However Google might have the paged indexed with the filename, or it might not. So when I do the redirect, do I put the filename or not?

I thought of doing two lines, one for both, but then you run the risk of duplicate content.

Thank you!

Robert Charlton

5:42 am on Apr 24, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



www.domain.com/subdir
www.domain.com/subdir/index.htm

Both are the same

Actually, what you want is...

www.domain.com/subdir/

...with a trailing slash.

See...

Redirect /folder/index.html to /folder/
[webmasterworld.com...]

LongView

6:27 pm on Apr 24, 2007 (gmt 0)

10+ Year Member



This is the reverse of that.

What if google has both of these indexed?

[domain.com...]
and
[domain.com...]

And I want both to now go to a new URL.

AND QUESTION TWO.................

If my home page is changing from index.htm to index.php

would my 301 redirect line look like this?

Redirect 301 index.htm index.php

[edited by: LongView at 6:31 pm (utc) on April 24, 2007]

Robert Charlton

6:57 pm on Apr 24, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Redirect 301 index.htm index.php

LongView - Now I'm getting what you meant earlier by "doing two lines." You're using a very simple redirect syntax. It's a syntax I used for my first sites; it served me well for a while; but it's very limited in what it can do.

I am by no means an "expert"... I tend to hire experts when I need something elaborate done... but I can tell you that rewriting file extensions for an entire site, or fooling around with the default index page settings, is something that's best done using mod_rewrite, and most likely is going to involve an understanding of your server setup as a whole.

Since you mention php, it's likely that you're on an Apache server. You're much more likely to get an in depth discussion of your problems over in the Apache forum, where the post I cited above came from.