How to Move WordPress Blog to a New DomainNeed to change the domain name of your website? How to move WordPress blog from an existing domain to a new domain? In this quick guide, we will learn how to move WordPress blog to a new domain in the most efficient manner.

Disclosure:We receive compensation from companies whose products and services we feature. All links, coupons & recommendations on this website should be treated as paid advertisements.

I often help people move their WordPress blogs from one location to another, often to a new domain. The process of moving WordPress blog to a new domain is fairly simple. Just follow the steps in the right order to ensure a smooth transition without annoying your readers or search spiders.

Before you go ahead, you should know how to install WordPress.

  1. Add a robots.txt on the new domain with the following contents:
    User-agent: *
    Disallow: /
  2. Copy the database and files to the new domain.
  3. Edit wp-config.php to reflect the right database settings.
  4. Add the following lines to wp-config.php. Don’t forget to replace example.com with the right domain name.
    define('WP_SITEURL', 'http://www.example.com');
    define('WP_HOME', 'http://www.example.com');
  5. Set up your new blog with the same settings as on the old domain. Don’t forget to delete your cache files if you are using some caching plugin.
  6. Install the Search and Replace plugin. Find and replace all instances of old URL with your new URL.
  7. Now, allow access to search spiders by removing the robots.txt file (or editing it).
  8. We need to redirect your old blog URLs to the new one. In the old blog directory, add the following line to your .htaccess file:
    Redirect 301 / http://www.newblog.com/
  9. You also choose to rewrite the URL instead of using the above method for redirection.
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldblog\.com\.?(:[0-9]*)?$ [NC]
    RewriteRule ^/(.*)$ http://www.newblog.com/$1 [R=301,L]
    
  10. Delete the old blog files and database.

Guess what? You are done! If you think that something’s missing or faulty, don’t feel shy to rectify or improve it. Need more help! Leave a comment or shoot me a mail.