Moving domains is sometimes necessary, such as following a rebrand or change of site identity. For example, when I rebranded this blog into That Marketing Punk, the old URL no longer suited the site or its name. So, I had to move to a new domain that better fit the new brand and name of the blog.
And when it comes to moving a WordPress site, it’s not the same as moving a static HTML site. As WordPress is database driven, things can be quite a bit more difficult. So, here is the exact method in which I moved this site, and a number of sites for clients.
To get started, you obviously need a domain name and a new hosting service. Where you get these is entirely up to you, but make sure you choose a hosting provider that offers enough storage and bandwidth for your needs.
Personally, I moved my hosting to KazooSoft, because the hosting plans suited my needs and I knew I could trust that I would get support when needed. So, obviously, I would recommend looking into them for hosting.
Once you have your hosting, you’ll need to make sure that your domain is pointed to that hosting. If you buy a domain and hosting package together from one supplier, then this will already be done. However, if you bought them separately you will need to change the DNS settings for your domain within the admin panel for your domain provider.
To do this, set the A records to the IP address of your hosting service. Doing this will tell the domain provider that your domain should point to that IP address and load the website hosted there.
Note: It can take up to 24 hours for a DNS change to take effect. So if you had to change yours, you will need to wait before continuing the migration.
Once this is all sorted and your domain is loading up the default webpage, you can move onto the next phase.
2. The Files
This one is pretty simple really. Make sure you download all of the files in your current WordPress installation. And yes, I mean all of them. That includes any themes and plugins you are using, as well as all media you have uploaded.
This can be a lot of files, so use an FTP client if you have access to one (I would recommend FileZilla). Otherwise, use your File Manager within your current hosting to download everything in a compressed file, or individually if that option is not available. Once this is done, you will need to upload those files to your new hosting server, ensuring that they are all kept in the same the folder structure!
Note: It’s really important to keep the same folder structure, otherwise themes and media won’t work on your new site.
And so, with that done, it’s time for phase 3 of migration.
[ctt template=”5″ link=”9X4VN” via=”yes” ]”Make sure you keep the same folder structure when moving a #WordPress site, otherwise your media files will break!” @marketing_punk[/ctt]
3. The Database
Now we’re getting into something a bit more technical, but the actual migration should be easy if you follow these steps;
- Log in to PHPmyAdmin through your current hosting provider to gain access to the database.
- Click on the Export menu option at in the top menu, and then press Go on the page that loads. This will download an export of your entire database as an SQL file.
- Open PHPmyAdmin through your new hosting provider, and click on Import in the top menu. Click on the Browse button, locate the SQL file you downloaded, and upload it to this database. MySQL should automatically run it, importing all of the settings and data exactly as they were for the original site. That includes theme options, posts, links and everything else.
- Within the wp_options table (the prefix can change depending on what it is set to in your database, but the table will always have _options at the end of it) click on the first two entries. These should contain the old domain name, so replace that with the new one.
- Now, go to the new domain and you should see your website load up. So, onto the final stage of the migration.
[ctt template=”5″ link=”b9abc” via=”no” ]”Change the URLs in the first two entries of the wp_options tables in the database when moving a #WordPress site domain!” – @marketing_punk[/ctt]
4. Search and Replace
Now that your site loads, you need to do one final change to the database. At the moment, it will be loading images from your old hosting, and unless you only have a handful of them, you really don’t want to have to go through all of your posts and update the images in them. Oh, and if you have custom links in the navigation or internal links within the content or sidebar, they’ll also be linking to the old domain.
So, to make as easy as possible, you should log into WP-Admin on your new domain, and install the Search And Replace plugin.
Once you have installed and activated Search and Replace, you need to go into the plugin within the dashboard. Once in the plugin’s section, you’ll see a number of fields.
- First, put the old domain name, without the http:// or www. into the top field. E.g example.com
- Put the new domain name, without the http:// or www into the second field. E.g newdomain.com
- Select all the tables listed in the third field, to make sure you find all of the references to the old domain.
If this is your first time using Search and Replace, I recommend running a “dry run” by having that option ticked. Rather than actually carry out the replacement, this will make the plugin simply tell you how many replacements it will do.
[ctt template=”5″ link=”64ZnX” via=”yes” ]”Use the Search and Replace plugin to change all references to your old domain when moving your #WordPress site!” @marketing_punk[/ctt]
When happy with that and ready to actually do the replacement, make sure you fill out all of the fields again (in the same way I just mentioned), untick the Dry Run option, and select the Make Changes To Database option rather than Save as SQL one.
Once you run the plugin this time around, it will replace all references to the old domain to the new one. That means that your images will be linked to the ones on the new host and not the old host. Your internal links and custom links will all be updated, as will any links to files.
And That’s It
Once you’ve done the Search and Replace, you’ll have fully moved your WordPress site to your new hosting and domain. Well bloody done! That is a hard thing to get your head around so you can give yourself a pat on the back and a little cheer if you want!
Did you find this guide helpful? Then it would be great if you could share it!
[ctt template=”5″ link=”U62f8″ via=”no” ]The Ultimate Guide to Moving A #WordPress site by@marketing_punk is a great resource for any #Blogger![/ctt]
Have you recently moved a WordPress site? Are you planning to? Was this helpful? I’d love to hear from you, so why not leave a comment whilst you’re here?