Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Let's say we are currently hosting our WordPress blog on certain domain and would like to move it to a new domain. How to do this with the least hassle and SEO hit?

Are there any plugins that could help with this? (for example providing automatic cross-domain 301 redirection or similar)

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted

I recommend handling the 301 redirect in your web server rather than in WordPress. mod_rewrite or RedirectMatch will be much more efficient than spinning up WordPress to deliver a Location: header.

<VirtualHost *:80>
    ServerName busted-cheap-url.com

    # mod_alias
    RedirectMatch permanent (.*) http://great-new-url.com$1

    # OR mod_rewrite
    RewriteEngine on
    RewriteRule (.*) http://great-new-url.com$1 [R=301]
</VirtualHost>

There are several methods for changing the blog URL; I tend to prefer setting a new WP_HOME and WP_SITEURL in wp-config.php as a quick fix, and running SQL commands in the database as a more permanent solution.

See also:

share|improve this answer
    
However, the entire Wordpress configuration remainsunder the old domain, and if this domain is now used for another purpose, or is sold to someone else, this will not work. –  jfmessier Sep 3 '10 at 12:09
    
Are you referring to the WP_HOME/WP_SITEURL modification? –  Annika Backstrom Sep 3 '10 at 17:51
add comment

Look at the previous answer as to SEO and 301 redirect. As for moving wordpress:

  1. Change the site_url and home_url values in your db. these two values resid in wp-options. just use the phpmyadmin interface to change them to the new wordpress location
  2. Use wordpress search&replace plugin in order to make sure all your in-bound links and images don't break. (just change http://oldurl.com to http://newurl.com for all content and post meta it's a fairly easy to use plugin)

That's about it. you're good to go.

share|improve this answer
add comment

What I like to do is to export the wordpress database to a .sql file. Then do a find/replace on oldurl.com to newurl.com. Yes, you can just change your site_url and home_url in the options table, but you will have missed A LOT of other places.

Not to mention, some plugins will break if you don't do it this way.

Once you make the change, import your .sql file into the new database on the new server.

share|improve this answer
    
Note that the question doesn't necessarily imply a host change. Using a plugin like search & replace is easier for people who doesn't know sql... –  hannit cohen Sep 4 '10 at 7:02
add comment

The WordPress Codex is an excellent tool. :)

http://codex.wordpress.org/Moving_WordPress

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.