There are times when domain/URL migration becomes a necessity. Though it might seem easy and straightforward, when moving your website to a new domain there are a number of factors that have to be taken into consideration to get you a smooth transition and, of course, the least downtimes possibly. On top of that, if you also need to change hosting provider, things get even more complicated and could get messy if not handled properly.
So let's delve into what you need to be aware of before moving your website to a new domain, both within your current hosting and to a new one. But before that...
First and foremost, create a backup
As it should be already the very first step to any task, edit or update you want to perform on your WordPress website, it is important to create a backup for your site before you begin the migration process. There are various plugins out there that help with this, so please take a moment to do that before you start anything.
Changing domain within the same hosting provider
There are two options to perform a domain change, one easier than the other. The former occurs when you want to maintain your current hosting provider and you "just" want to change the URL, while the latter is if you want to change your hosting provider as well.
If you have no plans on moving your website off to a different hosting provider, it is possible to simply switch domains while staying on the same account. It could be the case that the plan you're on right now won't allow that and you might be asked to upgrade or to create a new user. Nevertheless, in this scenario, the domain/URL change will be performed by the hosting's technical staff based on your request.
For common configurations, this process is an easy task that won't bring up major issues. Yet, if your website or store features some advanced configurations, you might want to have your in-house developers be in charge of the migration process.
It's worth noticing that not all hosting providers are the same and can offer the same level of quality when performing such domain change. Since there's a high chance your website could break - if things aren't done correctly - you might want to discuss in advance what's their procedure behind the switch.
Changing domain to a new hosting provider
The other path is that you might have to create a new account to a different and new hosting provider and migrate all your files there. This process is a little longer and more troublesome than the other we just saw. Therefore, if you're not familiar with this procedure, it's advisable to get help from an expert to handle the entire process for you. As WordPress developer and Codeable expert Daniel Stanojevic reinforces this idea:
Since there are many factors that go into a domain change in the database, I'd always recommend hiring an expert to do a migration instead of attempting it on your own unless you're very familiar with WordPress. The reason being, you won't be able to work it all out on your own if you're not familiar with it. Now, you may find a plugin that does it all for you and it may work or it may not work. But without manually reviewing the whole site, you're not going to be sure either way, which is why I think hiring someone to do it for you is the optimal path.
The emphasis falls on having an expert handle it for you in case you lack the technical expertise to perfectly handle WordPress site migration and any hassles that might come with it.
Plugins can help but that doesn't mean things are easy
The beauty of WordPress is the extensive amount of plugins that can play with it to handle everything from the basic to extremely complex processes. And, of course, there are some that can be really useful - if configured and handled correctly - even for moving your website to a new domain name and hosting provider. Daniel summarizes the process:
There's a plugin called WP Migrate DB that lets you create an export of your database, and while you're doing the export you can also define the domain change in the database. Let's say your domain is example.com, ok? When you're doing the export, there's a field where you can type in example.com as your current domain and then mynewdomain.com as the new domain. Once you export it, the file that gets created contains basically the database as it will be on the new domain with all the work done for you already in terms of getting the links and everything updated.
The idea of relying on a plugin might lead you into thinking this is an easier task than how it actually is. It all comes down to how technically savvy you are, hence feel confident with managing database dump files and SQL. If you make mistakes here, you could "break" your website.
Database and files are handled separately
Although a plugin like WP Migrate DB can help you transfer the entire database of your site from one domain to the new one, it doesn’t cater to your files, which are your images, media files, theme, and plugins. These files have to be downloaded separately and then uploaded onto the new domain. As Daniel explains:
WP Migrate DB is used to download the database only, which is the more complex part. While for your files, you can simply download them through FTP, SFTP or if your hosting provider lets you download a full backup of your site that's another good path to easily get them.
To locate your files in WordPress, you should look for a folder called public_html or Public or even just a domain name like yoursite.com. This is going to depend on your hosting provider, but basically, you keep looking until you find the directory that has wp-content, wp-admin, and so on. Those are the folders and files you want to select and, at first, copy locally, then move to your new domain.
Don't forget about preventing SEO losses or penalties
When moving your WordPress website to a new domain and hosting provider, you don't want to flush all your SEO rankings down the toilet. There are several aspects that will prevent you from compromising your SEO, the main of which is leveraging correct 301 redirects to tell Google and other search engines the website has moved.
Don't forget to take them into account and discuss them either with your hosting provider or with the developer in charge of the transition.
Changing hosting provider and moving your website to a new domain might sound a trivial task ("We can use a plugin for that!"). Yet, you shouldn't underestimate it because if things haven't planned properly, your website might break and you already know how bad that is for your business.
Depending on where the new domain is hosted (same provider vs new provider) the need of having an expert take care of the transition increases. That means you should only embark on migrating your site on your own if you think you’re capable of handling the entire process and any technical glitches that might arise. Otherwise, it is best to call in an expert. The rest of the pieces just fall into place from there on.
This blog post features Daniel Stanojevic who is the co-founder of pixelDuo, a small development agency focusing on quality over quantity and long-term client relationships. They’ve worked with WordPress and have created countless solutions helping businesses all over the world thrive for over a decade. Since 2013, they also build web applications with the Laravel framework.