WordPress moving

How to Move a WordPress Blog From One Domain and Host to Another

from wikiHow – The How to Manual That You Can Edit

Moving a blog from one hosting provider to another is not that difficult of a task, but changing domains in the process can be a headache. There are six main steps, which this article will walk you through:

  1. Prep your old site
  2. Prep your new environment
  3. Work on a local copy of your site
  4. Install old files in new environment
  5. “Shut down” old site
  6. Post production work

There is a bit of work that you need to do for this so it’s recommended that you read through this post fully first before you start.


  1. Pay attention. When you are executing command line or mySQL commands, be sure to check quote marks. If you cut and paste from this article, you may get incorrect characters for the quotes. It is sometimes better to hand type in the single and double quotes.
  2. Take notes or keep a log of what you do (just in case you have to do it again).

Prep your old site
On your OLD DOMAIN and server, do the following:

  1. Make a mySQL backup of your current DB. You can use a plugin (e.g. WP-DBManager).
  2. Download a full copy of your current WordPress web directory (this will preserve the active state of plugins should you ever need that as well as the DB backup you just did).
  3. Print out or save a list of your active plugins (it’s worth it).
  4. Put site in Maintenance mode (you can use a plugin like Maintenance Mode which is great for putting your site offline for the public but still allowing you to see and work with it assuming you are logged in).
  5. Once in Maintenance Mode, disable all non-essential plugins (e.g., leave Maintenance Mode plugin on and WP-DBManager on as well).
  6. Do another full download of your site (optional but do it if you made any changes to plugins – updated or deleted for example).
  7. Go to phpmyadmin (or command line mySQL ) and do a full mySQL dump – or you can probably use the SQL dump that WP-DBManager provided.
  8. Be sure you save original files before making modifications (e.g., create multiple directories, one for the “original” web files and mySQL dumps, and then one directory for later modifications of files and mySQL on your local machine)

Prep your new environment
On your NEW environment, do these steps:

  1. Create an empty DB (get all of the details for later: server, db, user, password).
  2. Create a web folder for your new WordPress installation.
  3. Create a robots.txt on new site with the following line:
    Disallow: /
    This will prevent search engine robots from crawling your site while you work on it

Work on a local copy of your site
On your LOCAL computer (e.g., where you downloaded all of your info to), do the following:

  1. Edit wp-config.php with to set your new domain:
    define(’WP_SITEURL’, ‘http://www.NEW-DOMAIN.com’);
    define(’WP_HOME’, ‘http://www.NEW-DOMAIN.com’);
    Put these almost at the top of the file prior to other “define” calls.
  2. Edit wp-config.php with your new DB settings (server, db, user, password).
  3. Edit the starting lines of your mySQL dump file to specify the new DB name in your NEW environment. It should be in the first section. Something like:
    /* CREATE DATABASE ‘database_name’ DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; */
    USE ‘database_name’;
    Note: You can comment out the “create database” part if the provider you use creates the DB for you. Just use the “use” clause.

    • In this example, 1and1.com is the provider used, and in this case you must edit the .htaccess file to force the server to use PHP 5 and prevent pesky Server 500 errors: AddType x-mapp-php5 .php
  4. Do a search for the URL as a content string within your WP directory files. Sometimes plugins or themes have hard-coded links (one called cformsII does this where it writes the full path to the location of the js file). Search for your old domain name “http://www.old-domain.com”. Open and review those files and change them, if appropriate, to “http://www.new-domain.com”. Be sure to try variations of this (e.g., without the “www”).
  5. Delete anything in the wp-content/cache (e.g., if you have a caching plugin enabled). You may want to comment out the cache info on your wp-config.php file to make sure it is off there as well.

Install old files in a new environment
On the NEW Server, do the following:

  1. Upload your local modified DB to your new site. Warning, it’s better to use mySQL commandline than phpmyadmin. There are limits to the sizes of files you can upload using phpmyadmin. For 1and1, SSH was used to connect to the server and also the DB was uploaded to a distinct directory via FTP and put in this directory (e.g., called “mysql”). Then, via SSH, change to that directory and execute the following command: ”mysql -h SERVER -u USER -p DB NAME < DUMP FILE.sql” (without the quotes and obviously updating the SERVER, USER, DB NAME and DUMP FILE with your info) and then at the password prompt entere the db password. Hit enter and then let it populate the new DB.
  2. While your data is loading, upload your WordPress files (the ones you modified) to your new server.
  3. Wait around while it all transfers.
  4. Once everything has transferred, go to http://www.new-domain.com/wp-admin and log in (remember, you site will hopefully still think it is in “Maintenance Mode” based on how you left the old site).
  5. Install and Activate the following two plugins:
  6. Do search & replace with both plugins with old/new domains.
  7. Update permalinks within WordPress.
  8. Go to phpmyadmin and run 3 queries/updates:
    • Update WordPress Settings in DBUPDATE wp_options SET option_value = replace(option_value, ‘http://www.old-domain.com’, ‘http://www.new-domain.com’) WHERE option_name = ‘home’ OR option_name = ’siteurl’;
    • Update Permalinks in DBUPDATE wp_posts SET guid = replace(guid, ‘http://www.old-domain.com’,’http://www.new-domain.com’);
    • Update Any Links within your blogs contentUPDATE wp_posts SET post_content = replace(post_content, ‘http://www.old-url.com’, ‘http://www.new-url.com’);
  9. Go back to your printout and activate all of the other plugins.
  10. Test, test and test again.
  11. Update your sitemap.xml (via plugin or whatever).
  12. Remove the two lines in wp-config.php where you manually defined new domain
  13. Test again.
  14. Remove robots.txt file.

“Shut down” the old site
Back at your OLD site, you need to tell it to send all traffic to the new site and new URL. The best way to do this is via 303 redirects. You want to be sure you have this in place especially if your previous domain was heavily indexed by the search engines.

  1. Set up redirects: either via hosting control panel or directly in .htaccess (this is a great guide to applying Apache 303 redirects).
    • Be sure that your redirects preserve the full path to your new site. For example, if www.old-domain.com/test_post/ existed, it should redirect to www.new-domain.com/test_post/.

Post production work
This part becomes very subjective. It all depends on what you have set up for your old blog. You may have more or less work to do. The items below are only some suggestions and will probably help you get started thinking about what you need to do.

  1. Update any 3rd party items:
    • Google Analytics
    • Discussion plugins
    • Feedburner
    • Social Profiles
    • Ad networks
  2. Get friend to test.


  • Take notes or keep a log of what you do.
  • Read all of these directions at least twice.


  • This is tricky for some and very easy to screw up. It may take a lot of research, reading and trial and error before you get it to work.
  • When you are executing command line or mySQL commands, be sure to check quote marks. If you cut and paste from this blog post, you may get incorrect characters for the quotes. It is sometimes better to hand type in the single and double quotes.

Related wikiHows

Sources and Citations

Article provided by wikiHow, a wiki how-to manual. Please edit this article and find author credits at the original wikiHow article on How to Move a WordPress Blog From One Domain and Host to Another. All content on wikiHow can be shared under a Creative Commons license.

Sorin Adam Matei

Sorin Adam Matei - Professor of Communication at Purdue University - studies the relationship between information technology and social groups. He published papers and articles in Journal of Communication, Communication Research, Information Society, and Foreign Policy. He is the author or co-editor of several books. The most recent is Structural differentation in social media. He also co-edited Ethical Reasoning in Big Data,Transparency in social media and Roles, Trust, and Reputation in Social Media Knowledge Markets: Theory and Methods (Computational Social Sciences) , all three the product of the NSF funded KredibleNet project. Dr. Matei's teaching portfolio includes online interaction, and online community analytics and development classes. His teaching makes use of a number of software platforms he has codeveloped, such as Visible Effort . Dr. Matei is also known for his media work. He is a former BBC World Service journalist whose contributions have been published in Esquire and several leading Romanian newspapers. In Romania, he is known for his books Boierii Mintii (The Mind Boyars), Idolii forului (Idols of the forum), and Idei de schimb (Spare ideas).

2 thoughts on “WordPress moving

Leave a Reply

Your email address will not be published. Required fields are marked *