Need 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.
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.
- Add a
robots.txt
on the new domain with the following contents:User-agent: * Disallow: /
- Copy the database and files to the new domain.
- Edit
wp-config.php
to reflect the right database settings. - 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');
- 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.
- Install the Search and Replace plugin. Find and replace all instances of old URL with your new URL.
- Now, allow access to search spiders by removing the
robots.txt
file (or editing it). - 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/
- 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]
- 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.