Move Your WordPress Site To A New Domain Seamlessly

Having had to go through this process myself, I wanted to write a tutorial on it and share my experience on the subject. Moving your whole WordPress installation to a new domain can be daunting, but by following these steps, it will be a painless process for you and when you type your new domain into a browser and see your site, just as it was on the old domain, you’ll wonder what all the fuss was about.

To move your WordPress installation to a new domain, follow these simple steps:

1. Buy new domain and hosting

First of all, settle on your new domain name, purchase it and arrange for hosting to go with it. Make sure that the DNS is resolving correctly before you switch over. You don’t want to pull your current site down, only to find that the new one isn’t yet resolving.

2. Copy all your files across

cPanel's File ManagerUse FTP, cPanel, SSH (or any method you like) to copy all files to your new server. Be sure to get the wp-admin, wp-content and wp-includes folders and all the loose files that reside in the root folder. Be especially sure to get your wp-config.php file (since this may not be in your root folder).

3. Export your database

Access phpMyAdmin through cPanelYour database is where all the meat of your WordPress installation lies, like all your post content, categories, tags and users. Use phpMyAdmin (or other SQL solution) to export your entire database and save the file on your computer.

4. Create a new database

cPanel's MySQL functionOver on your new hosting, use phpMyAdmin or cPanel to create a new SQL database and user. Assign the user to the database, giving it all privileges.

5. Edit your wp-config.php

Look in wp-config.php in its new location. Check that if there are any references to your old domain (such as define(‘WP_HOME’,’http://example.com’);) that you change them to reflect your new domain. Also be sure to update your SQL database login information and FTP information, if this is included in your wp-config.php.

6. Change domain references in your database

Your database is going to be littered with references to your old domain. Any references to images, posts and your home page will all now be invalid. Use a text editor to find any references to your old domain, and replace them with the new. For example, search for http://www.thewanderingbrit.com (my old domain) and replace it with http://www.doitwithwp.com (my new domain). Be wary of any references you may have used with or without the www and account for it. Save the file.

7. Upload your SQL file

Take the database file and import it into your new database using phpMyAdmin.

8. Make sure everything works

You should have now completed all the steps needed to move your installation to your new domain. Go to your new domain in a browser and make sure that everything’s working as it should.

9. Redirect traffic to your new domain

cPanel's redirection functionNow that you have your new site up and running, you want to redirect all traffic from your old site to your new site, so that you don’t lose any traffic and so that any rank with Google is transferred to your new site. There are a few ways to do this – you can either use cPanel on your old site to create a permanent redirect (301), or you can write the 301 redirect into your old .htaccess file manually. To do this, open up .htaccess and remove anything that might be inside and write the following:

This will redirect all traffic to your blog to the same address in your new domain (where http://www.doitwithwp.com is the new domain in the example above). So individual pages will be sent to the same addres on your new domain (i.e. http://www.thewanderingbrit.com/wptouch-is-a-godsend-in-an-increasingly-mobile-world/ will be redirected to http://www.doitwithwp.com/wptouch-is-a-godsend-in-an-increasingly-mobile-world/ – you can check, by trying to visit the old page. You should be sent to the new address.)

You can check that your 301 redirect is working by using a redirect checker tool.

This sequence should see your site moved completely seamlessly to your new domain. You should have all your images and files on your new site, all the posts should be completely intact, with all the links changed to reflect your new site and any visitors (including search engines) to your site should automatically sent to your new site and update their indexes, carrying any rank with it.

As always, if you encounter trouble, leave a comment, or get in touch with me. I’m here to help!

34 thoughts on “Move Your WordPress Site To A New Domain Seamlessly”

  1. Hi, thanks for the tutorial. Concerning the redirecting, something seems to be missing. http://blog.mangaworld.se now redirects to http://anton.nordenfur.se, but http://blog.mangaworld.se/wp-admin redirects to http://anton.nordenfur.sewp-admin.

    1. Dave says:

      Absolutely right. Good catch. I’ve updated the tutorial to reflect this. And thanks for the mention on your own blog, I really appreciate it.

  2. Daren says:

    This a pretty fool-proof way of switching a WP install over. I definitely prefer it over the wordpress export import way.

    1. Dave says:

      Yeah, I don’t have much faith in the export/import function. I’ve used it a couple of times and it’s worked, but it feels like a train on wonky rails

      1. Same with you, i don’t really trust import tool either, i prefer do it like they way you did it in your tutorial above.

        So far works well, a bit longer but works well without any error, which is important to me.

        Thanks,

        Happy holidays!

        Kimi.

        1. Dave says:

          Hey Kimi,

          Yes, with any luck, I won’t have to go through this any more, now that I’ve settled on a domain name and am happy with everything. I’m sure I’ll still end up doing it for clients occasionally.

          Happy New Year!

  3. James says:

    This is a pretty slick tutorial but I would add to this the need to consider SEO when moving your wordpress site to a new domain.

    You mention a 301 redirect which obviously prevents a 404 error but at the same time this will just send all traffic to your homepage which isn’t necessarily the best user experience.

    The best way (although it is considerably more work) is to implement a series of 301 redirects to take users who find pages on your old site to relevant pages on your new site.

    Google have produced a guide on this … http://www.google.com/support/webmasters/bin/answer.py?answer=83105&hl=en

    James

    1. Dave says:

      James,

      Thanks for your comment. Actually, as I mentioned in my tutorial, the method you suggest is certainly the best way to redirect all your traffic. You want anyone landing at http://www.domain1.com/articleA to automatically be redirected to http://www.domain2.com/articleA. That was part of the seamless transition that I am referring to in the title.

      However, the above 301 redirect method works correctly. Using that syntax with the trailing slashes means that all content under the somain will be redirected to the same location under the new name. It is the method I have employed on a number of website moves (which all work this way) and after a little research, I confirmed that this approach will correctly redirect all individual addresses to the same address on the new domain.

  4. Dustin says:

    This guide is perfect Dave! It worked flawlessly.

    Thanks buddy,

    - Dustin

    1. You’re welcome Dustin. Any time.

  5. Barry says:

    I hope this isnt too off topic, but I have a non-wordpress site that I have managed to move about 2000 posts across to my new wp site using CSV, but am battling to get the images across, about 3 images per post, is there any way this can be done in CSV? I am not sure what the correct CSV headings for WP would be for the image links. Any ideas?

    1. Is it the actual images themselves you’re trying to copy across or references to the images in your posts?

      1. Barry says:

        it is the references to the images as I already have them placed in the right area but dont know how to link them to their respective posts

        1. I’m not quite sure what your site looks like, but I would think that you’d need to manually go through and update all the images. What was your old site built on that you managed to get a CSV file from it? WordPress can import multiple file types and it will bring in the images automatically.

          1. Barry says:

            I was hoping that was not the answer! I dont know what the platform it was built on but I exported from phpmyadmin, and changed all the headings to suit wordpress and classipress. How does wp bring in the images automatically? I take it that its not as simple as putting the right header in the csv file for the image links? my site is hoonoze.com (the old site, its a mess and is looking much better in the localhost wordpress re-do)

          2. I’d have to have a look at it to know what you’re talking about, but the post content should have the image references in them. It would be probably be a case of doing some find and replace to change the domain name.

  6. ziad says:

    Thanks for the great tutorial. Everything worked flawlessly for me too. There were a few extra things that needed to be changed in my sql file as well. Quick question, because your contact form is not set up, do you use a plugin for your comments styling? I’m thinking similar to Disqus?

    thanks.

    1. Hey, thanks for letting me know my contact form was broken. I didn’t even know. I’ve fixed it now, thank you. As far as my comments system, I use the default WordPress comment system (not Disqus or Intense Debate) and the styling is part of the theme that I use on my site. I’m not sure that I’ve even modified it too much.

  7. Harold Meansfield says:

    Hi,

    Thanks for helping me out. I tried everything today to get my old wordpress based website up and running on another domain on Godaddy.com, but there were some problems every time. Very annoying, but after using your simple method, it worked well.
    (i was also afraid that I would lose all the backlinks and so on, but with that 301 redirect trick it will not, right?)

    Best regards,
    Harold

    1. That’s right – with the 301 redirect, any backlinks pointing to your old links will be properly attributed to your new URL structure, including a new domain if there is one.

  8. PS. I used the 301 redirect for my blog. So I had a website http://www.old-domain.com and I wanted to transfer all the pages on http://www.old-domain.com to

    http://www.newdomain.com (so now the keywords are without the – between them). So I moved the whole website from old-domain.com to http://www.newdomain.com

    new wordpress installation, same theme, exact same page, exact same locations, exact same comments etc etc. Then

    I put in the htaccess file on the old website

    301 redirect / http://www.newdomain.com

    But it redirects only the front page to the NEW front page.
    But all other pages ARE NOT redirected

    ( I have deleted the whole WordPress installation on the OLD website, is that maybe the problem?)

    1. It’s not a problem that you deleted the WOrdPress installation. However, there’s a minor problem with your .htaccess text. You need to change it to:

      301 redirect / http://www.newdomain.com/

      Be sure to add the trailing slash on the end (which is what you omitted). Let me know if that works for you :)

  9. Yes,

    It worked perfectly. Thanks man, but I have another question. How long does it take to get google to replace the old domain with the new domain in the search engine? I did a little bit link building for it, but still the old pages are indexed (some of the old pages can’t be found anymore, because the old website was down a couple of weeks)

    1. It can sometimes take up to a month or two, but you can nudge it along by resubmitting your sitemap to Google by using Google Webmaster Tools. Point is, if your 301 redirect is in place, it won’t matter if they’re indexing the old page, because it should be forwarding to the correct new page on your new site

  10. Alex says:

    Thanks so much, this is still working 2012! Just transferred 5 of my domains using this method.

    1. Good to know. Thanks for the update!

  11. Kalee Eversole says:

    Hey there, I just used this method to move a WordPress site for my client from my GoDaddy server to their server on Pair.com with a new domain – I followed all the steps, however some things aren’t working for me. This is also the first time I have ever moved a WordPress site, so that doesn’t help ha. I am able to log in and view the home page, but I can’t view any of the extra pages. For example, I have a Bio, Contact, etc. Can’t see those. I get “Not Found – The requested URL /music/ was not found on this server” Also in my permalink settings I get a message about my .htaccess file not being writable, which doesn’t appear on the site on my server. Also, all but one of my plugins came through. I am totally at a loss for what happened. I am trying to find my .htaccess file and can’t even find that. Any help would be great.

    Thanks!

    1. Yeah, the .htaccess should be in your website root folder, though it appears you’ve already figured that out.

  12. Kalee Eversole says:

    Well, I got the .htaccess figured out and all my extra pages are showing up but my plugins are still no where to be found, but this is the least of my worries. Any idea about the plugin whereabouts would still be greatly appreciated though! Thanks!

    1. The plugins reside in wp-content/plugins. Just copy that entire folder from the old server to the new, and then activate them.

  13. Kalee Eversole says:

    Thank you for your quick responses. While it should be that easy, I just realized that some of my plugins do not show up in my old servers wp-content/plugins folder and I am getting a prompt to fill out my FTP info before installing a plugin and I’m getting an error when I try to upload new media. A permissions error. Strange stuff, never had either of these two things happen before. I realize this might not have anything directly to do with this tutorial, but would you have any thoughts on these things?

    Thanks,

    Kalee

    1. Yeah, it depends on how each server is set up. For FTP, you can define the FTP information in wp-config.php and the permissions error involves changing the permissions settings on the uploads folder.

  14. Kimi Wilson says:

    Thank you SO much for this article. I was terrified of doing this, and I read a lot of different articles with so-called “steps” but none of them were as easy to understand. I easily moved my WordPress site in about 30 minutes.

  15. Paul says:

    Watch out for serialized data when doing a search/replace for the domain names in the sql file!

Leave a Reply