You are here: BeebleBerry.com » Resources »

How to move your WordPress site to a new domain

How to move your WordPress site to a new domain

Moving a WordPress site can often seem daunting, however, it’s not as difficult as it might seem at first.  If you follow the steps mentioned below -  in order – you’ll have your site up and running on the new domain in jiffy.

1. Create a robots.txt file which denies access to bots (you’ll use this only while you’re moving your site and will need to change it to allow robots once you’ve completed the process).  The robots.txt file should contain the following:

User-agent: *
Disallow: /

2.Make a back up copy of your WordPress database.

3. Create a database on your new domain and import the back up copy of the database you made in step 2. (Make sure to keep a the database name as well as your database username and password handy).

4. Copy all your WordPress files to the new domain via FTP.

5. Now for a very important part! You must update the wp-config.php file as follows:

Edit these lines:

define('DB_NAME', 'yourdatabasename');
define('DB_USER', 'yourdatabaseusername');
define('DB_PASSWORD', 'yourdatabasepassword');

Add the following lines:

define(’WP_SITEURL’, ‘http://www.yournewdomainname.com’);

define(’WP_HOME’, ‘http://www.yournewdomainname.com’);

6. You will now be able to access the admin area of your site. Check all your general settings and update email details if applicable.

6. Install the Search and Replace plugin. This plugin allows you to find all old domain name links and replace them with the new domain name. Use the plugin to update all the links.

7. Update the .htaccess file on your old domain name to redirect traffic to your new domain as follows:

Redirect 301 yourolddomainname.com/blog/ http://www.yournewdomainname.com/

Note the there is no prefix of the domain name after the “301″ in the above code i.e. you DO NOT include” http://www”

Also note that if your WordPress blog was not placed in a sub-domain called “blog” then you won’t include the reference to blog which is included in the above code.

8. You may want to redirect individual pages or if you’re converting an existing site to WordPress, you should set up redirects for individual pages by adding the following code for each page  – it’s tedious but well worth the effort. You don’t want visitors and bots encountering “page not found”!

Redirect 301 yourolddomainname.com/oldpagename.html http://www.yournewdomainname.com/directory/newpagename

9. Test everything – a few times! Make sure that redirects are going to your new blog, that links in your domain are pointing correctly, that menus all work etc..

10. Update your robots.txt file to allow bots, or delete the file. Don’t forget to do this!

11. Once you have checked that everything is working and all is in order – you can delete the blog on your old domain, leaving the .htaccess file intact to ensure that traffic is redirected.

Following these steps should ensure a smooth transition. It’s the process we followed with BeebleBerry.com without any problems at all.

Feel free to ask any questions should you need some clarification, or add your own useful tips.

If you have a blog to move, and still feel daunted at the prospect, even after reading this post, BeebleBerry.com will do this for you. Contact us for a quote and include your current domain name.


Discussion

Leave the First Comment Here