Welcome to WebmasterWorld Guest from 54.163.168.15

Forum Moderators: Ocean10000 & incrediBILL & phranque

301 redirects for re-design

   
5:18 pm on Oct 23, 2011 (gmt 0)

5+ Year Member



This is my first time setting up 301 redirects using .htaccess and I want to make sure that I have it right.

I'm re-designing a new site for a particular domain, so I want to re-direct ranking pages from the old/current site to the new re-designed site. The domain stays the same.

Is this the correct code to use in the .htaccess file?
Redirect 301 /old/old_page.html /new/http://www.domain.com/new_page.html

Specifically, do I only include the full url for the new page?

Thank you!
Ron
6:22 pm on Oct 23, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



What you use depends on what the old URLs were and what the equivalent new URL for each one will be.

For best SEO effect, the new site should use the exact same URLs as the old one - unless you're also taking this opportunity to move from URLs with parameters to "searchengine friendly" URLs.

Requests should be redirected from old URL to new URL in a single step. Avoid any and all redirection chains, especially for non-canonical requests.
8:53 pm on Oct 23, 2011 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Specifically, do I only include the full url for the new page?

It depends whether you are using mod_alias or mod_rewrite. Here you are in mod_alias (Redirect by that name). It will reappend the rest of the path, if any. So

Redirect 301 /old http://www.example.com/new

(what was the "new" doing at the front of the path?) really means:

take anything containing
/old{blahblah}

and kick it over to
http://www.example.com/new{blahblah}

But if you used the equivalent wording in mod_rewrite

RewriteRule old http://www.example.com/new [R=301,L]

(note missing leading slash) it would mean

take anything containing
/old{blahblah}

and kick it over to
http://www.example.com/new

without attendant blahblah. To achieve the same result as the mod_alias version, you need to capture:

RewriteRule old(.+) http://www.example.com/new$1 [R=301,L]
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month