301 Redirect

Discussion in 'Site & Server Administration' started by LinkSales, Jul 22, 2010.

  1. #1
    Let's say I have domain.com and it is hosted on wordpress. I buy a new domain, move over the site to the new domain and keep the file structure intact.

    Domain1.com/word/topic-title

    Domain2.com/word/topic-title

    How can I easily do a 301 redirect of domain 1 to domain 2?
     
    LinkSales, Jul 22, 2010 IP
  2. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #2
    Like so

    redirect 301 /old/old.html http://www.newdomain.com/new/new.html
    Code (markup):
    Don't, whatever you do, decide to be a lazy sod and just redirect the domain only otherwise you will need to wait for all of the pages to be reindexed from scratch. Do a 301 redirect for each and every page.

    Further reading:
    http://www.tamingthebeast.net/articles3/spiders-301-redirect.htm
    http://www.isitebuild.com/301-redirect.htm

    Edited to add:
    If the file structure is identical you can redirect using htaccess with a single line like so:
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
    Code (markup):
     
    Last edited: Jul 22, 2010
    mcfox, Jul 22, 2010 IP
  3. theredsheep

    theredsheep Active Member

    Messages:
    65
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    95
    #3
    What mcfox said is spot on and will take care of the trailing part of the url after the main domain. If you're not comfortable with doing htaccess stuff yourself and this is a self-hosted wordpress issue, check out these two plugins as well. they can help if you dont have a lot of links, even if you have a lot of links, it allows for regex arguments so you can canvas a lot of pages at once provided they have similar or identical structures.
    1 - Redirection http://wordpress.org/extend/plugins/redirection/
    2 - Page links to http://wordpress.org/extend/plugins/page-links-to/

    And there are several other plugins that do similar stuff. Of course, htaccess will be faster and more efficient than the plugin but these are just other options.
     
    theredsheep, Jul 23, 2010 IP