So, you’re thinking about changing your domain name, and it feels like you’re staring down a mountain? Good news—it’s more like a little hill! While it might feel intimidating if you’re unfamiliar with the process, I promise you can tackle this in less than an hour—no help needed. Even if you’re not well-versed in websites or coding, it’s completely within your reach. Just follow the steps outlined below, and you’ll be set.
I’ve handled plenty of WordPress migrations—whether it’s moving servers, changing domains, or switching platforms. While URL migrations do require some careful steps, they’re totally manageable by anyone in under an hour!
1. The Obvious: Have Full Access to All Accounts
Make sure you’ve got full access to everything you need. This means having administrative access to your WordPress backend, your hosting account, and cPanel. You’ll also need access to wherever your new domain is registered. In many cases, your domain will be registered with your hosting provider, but if it’s not, make sure you have that access as well.
Once you’re set, go ahead and log into all these accounts in separate tabs in your browser.
2. Back Up Your Website
Before diving into any major changes, like a URL switch, it’s smart to have a backup of your site—just in case something goes off track.
A) If you’re already using a backup plugin, go ahead and run a fresh backup, then download all the important files, particularly the MYSQL database backup.
B) If you’re not using a backup manager yet (and really, you should be!), head over to your WordPress dashboard, and navigate to “Plugins > Add New Plugin.” I recommend UpdraftPlus; it’s a reliable, free option. Install and activate it to get your backup secured.
In the plugin’s interface, create a new backup and download all relevant files.
3. Point Your Domain
We need to ensure that your new domain is pointing to the correct folder.
If your domain is registered with the same hosting account, follow step 3A. If it’s registered on a different account or platform, skip to step 3B.
3A. If Your Domain Is Registered with the Same Hosting Account:
Log in to your hosting account and navigate to cPanel. Once you’re in cPanel, click on “Domains.”
On the following screen, check the “Document Root” listed next to your new domain to ensure it is pointing to the correct folder. If your website is located in a different folder within “/public_html,” use the “Manage” button to adjust the settings as needed.
3B. If Your Domain Is Registered on a Different Platform:
Start by locating the nameservers for your hosting account. Typically, you can find this information by searching online for your hosting company’s name along with “nameservers.” Keep in mind that if you’re using a VPS, the nameservers you find online might differ, so it’s a good idea to consult your hosting documentation for the most accurate information.
Next, log in to the account where your domain is registered. The procedure for changing your domain’s nameservers will vary depending on your provider, but you can generally find this option in the domain settings where you manage and edit your nameservers.
Update the nameservers to match those provided by your hosting account. This change will direct your domain to your hosting account, making your hosting provider responsible for all DNS entries. After saving these changes, log back into your hosting account and follow the instructions from the previous step to add the new domain and verify that it is pointing to the correct folder.
4. Enable the SSL
If you’ve already purchased an SSL certificate for your new domain, now’s the time to install it. If not, don’t worry—most cPanels offer a free AutoSSL, depending on your hosting package. Before making any URL changes, it’s crucial to ensure your SSL is installed.
Log in to cPanel on your hosting account, then go to “Security” and click on “SSL/TLS Status.”
On the next screen, find your new domain in the list. Click “Run AutoSSL” and wait a few minutes for the process to complete. Once it’s done, you should see a green circle next to your domain name, indicating that SSL is active.
If you recently updated your nameservers, the SSL might not activate immediately. In some cases, you may need to wait an hour, or even up to 24 hours, but it usually kicks in within ten minutes.
5. Update WP-Config
Now it’s time to update your website files with the new URL. We’ll do this by editing the wp-config.php file to hardcode the new URL and file location.
In cPanel, navigate to “Files” and click on “File Manager.”
Double-click on the “public_html” folder, where your WordPress files are likely stored. If your files are in a subfolder, navigate there instead.
Scroll through the list of files until you find wp-config.php. Click on it to highlight it, and then choose “Edit” from the top menu. Note that the method to edit might vary slightly depending on your cPanel setup.
After the “@package WordPress” line in the file, add the following lines, replacing yourdomain.com with your actual domain:
Define (‘WP_HOME’, ‘https://yourdomain.com/’); Define (‘WP_SITEURL’, ‘https://yourdomain.com/’); |
If your website is located in a subfolder within public_html, include that in the URL. For example:
Define (‘WP_HOME’, ‘https://yourdomain.com/mywebsite/’); Define (‘WP_SITEURL’, ‘https://yourdomain.com/’); |
Save the changes, and now you’re ready to log into your site using the new URL.
6. Log In
Now it’s time to access your site using the new URL. Head over to your new login page at https://yourdomain.com/wp-admin. Use your usual administrative username and password to log in—everything should work just as before.
7. Search and Replace
Next, you’ll need to update your database to replace all instances of the old domain with the new one. This is a straightforward and effective way to make sure everything is aligned.
In your WordPress dashboard, go to “Plugins” and click on “Add New.” Search for the “Better Search and Replace” plugin, install it, and then activate it.
Once activated, navigate to “Tools” > “Better Search Replace.”
In the “Search For” box, enter your old domain name (without https:// or a trailing slash). In the “Replace With” box, enter your new domain.
In the Additional Settings section, check the “Case-Insensitive” box and uncheck “Run as dry run.”
Very important: Before you click the “Run Search/Replace” button, double-check to ensure that the domains are spelled correctly.
If everything looks correct, proceed by running the search and replace function.
7. WordPress Permalinks
Sometimes, after a migration, your URLs might stop working even if everything else looks perfect. To fix this, go to “Settings” > “Permalinks” in your WordPress backend.
On this page, scroll down and click “Save Changes” twice, even though no changes were actually made. This action helps refresh your permalink structure.
Your website should now be up and running smoothly! However, we still have a few more steps to complete.
8. Redirect Your Old Domain
The simplest way to set up a redirect is through cPanel. Start by logging into your hosting account and accessing cPanel. Navigate to the “Domains” section and click on “Redirects.”
In the redirect settings, select “Permanent (301)” from the dropdown menu for the type of redirect. Then, choose your old domain name from the next dropdown field. Leave the third field blank to ensure the entire site is redirected. In the “Redirects To” field, enter the full URL of your new domain, including https://.
For the redirect rules, check both the “Redirect With or Without the WWW” box and the “Wildcard” box. Finally, click “Add” to implement the redirect.
Once you’ve set up the redirect, it’s important to test it to ensure it’s working correctly. Enter an old page URL (preferably an interior page, not just the homepage) into your browser and verify that it redirects to the corresponding page on the new domain. If the redirect doesn’t work as expected, make any necessary adjustments.
9. Update Affiliated Sites
With your new domain now active, it’s essential to update all associated platforms and sites. Begin by revising your social media profiles to reflect the new domain, ensuring that links and references are current. Don’t forget to update any other affiliated sites where your domain might be mentioned, such as directories, partner sites, or business listings.
Additionally, inform your customers and the public about the domain change. This can be done through an email newsletter, social media announcements, and updates on your website. Clear communication will help avoid confusion and ensure a smooth transition for everyone involved.
10. If Things Fail, Use the Back Up!
If you encounter any issues or if the migration doesn’t go as planned, don’t panic. You can always revert to the backups you created earlier. These backups will allow you to restore your site to its previous state before the changes were made. Simply follow your backup plugin’s instructions to restore from the saved backup files. This safety net ensures that you have a fallback option, giving you peace of mind and the opportunity to resolve any problems without losing valuable data.