Top Nav

How to Redirect Inbound Links After Moving Your WordPress Installation

Wordpress Redirect Inbound Links 301Earlier, I showed you how to move your on your web server.  This prompted a very good question from groovyReader Dinesh:

Thanks for the clear step by step methods with screenshots.
I wanted to ask a question: How did you manage to redirect the incoming back links from your old domain to new domain?

The answer: a 301 redirect in your .htaccess file. If that doesn’t make sense to you, don’t worry—it’s not as complicated as it seems. But it is the best solution for retaining your inbound links and your precious search engine rankings while moving your WordPress site (or any site) to a new directory or domain. A server-side 301 redirect is the kosher way to tell browsers that the site has moved permanently and is the most ethical and effective method for SEO purposes. Most importantly, Google understands it and won’t penalize you for the move in their search engine rankings.

Here’s how you do it:

Step One

, if you haven’t already. Don’t worry about leaving your old site behind—in fact, don’t, since this result in duplicate content issues. Keep your old directory there, but leave it empty.

Step Two

Navigate to the old directory and look for an .htaccess file. This would be the root of your old WordPress installation.

htacess 301 redirect wordpress

If it doesn’t exist, then create it in Notepad or another plain text editor. Make sure you name it just like that: .htaccess with the dot in front, as if it were a file extension with no filename. It it does exist, open it.

htacess 301 redirect wordpress

Step Three

If there is anything in your .htaccess  file, delete it.

wordpress move installation

Step Four

At the top of your .htaccess file, insert the following code:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com $1 [R=301,L]

Replace the red text with your domain and directory path, if necessary. For example, if I were moving my site from jantonbusch.com/pop to jantonbusch.com/princeofpretzels, I would use the following:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^jantonbusch\.com$ [NC]
RewriteRule ^(.*)$ http://www.jantonbusch.com/princeofpretzels/$1 [R=301,L]

Don’t forget to include all that junk around the URL, including the $1 and the text in the brackets.

wordpress 301 redirects

Step Five

Upload or save your .htaccess to the root of your old WordPress location.

wordpress 301 redirects

Step Six

Test out your 301 redirect. Try visiting a deep link on your old site and make sure it forwards to the corresponding page at your new location. If you don’t have an old link handy, just navigate to page other than the homepage on your new site and then swap out the old domain or directory path to test it.

moving wordpress installaiton 301 redirect

Conclusion

A 301 redirect is the best way to retain your inbound links and SEO juice when moving domains. Of course, it’s a temporary fix—you should encourage anyone sending you links to update their links with your new address, if possible.  But for the time being, a 301 redirect is a good way to transition to a new location.

If your move is temporary, use a 302 redirect (swap out R=302 where R=301 appears). If you want to get demoted for spam, use a browser-side META redirect.

Note: Being that no 2 web hosts are the same, the steps for uploading your .htaccess file to your web server or even your ability to edit or see your .htaccess file may vary from web host to web host.  With this in mind, please test before messing with your production web site and if you need help, check with your web host tech support as they should have a KB or FAQ article they can refer you to for editing your your apache .htaccess file.

, ,

2 Responses to How to Redirect Inbound Links After Moving Your WordPress Installation

  1. Dinesh @DailyBlogMoney February 1, 2011 at 9:59 pm #

    Thats why I like your blog and writing style.
    Thanks for the information you provided.

    Good luck

    • MrGroove February 2, 2011 at 9:22 am #

      Thnx for the feedback Dinesh. I’m glad Jack was able to answer your earlier comment. Hope it helps ya out.

Leave a Reply

 

×

Black Friday Deals at Amazon.com. Now through November 28th. Shop Now