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

Apache Web Server Forum

    
301 redirects for re-design
RonSolo




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

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

 

g1smd




msg:4378361
 6:22 pm on Oct 23, 2011 (gmt 0)

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.

lucy24




msg:4378415
 8:53 pm on Oct 23, 2011 (gmt 0)

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]

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