October 1, 2019
October 1, 2019
Some projects eventually need to be rebranded under a different name. This article will show you step-by-step how to change WordPress domain name for a WordPress website.
In many cases, changing WordPress domain name is inevitable. The most common scenarios are:
For the most part, the steps to change WordPress domain are simple, but some tasks will require you to tweak your site’s PHP code.
Keep in mind, modifying the code might put your website at risk if you don’t do it the right way. Be sure to follow these prerequisites before changing the domain name:
First and foremost, head to Hostinger’s domain checker and type in your preferred domain. You’ll find out if your option is available, and get some suggestions on a few alternatives.
From there, add your domain to the cart, and proceed to check out. Alternatively, you can also get free domain registration for the first year if you purchase Hostinger’s annual Premium or Business shared hosting plans.
The next step to change WordPress domain is to add your new domain to the WordPress General Settings.
Head to Dashboard -> Settings -> General. Replace your current WordPress Address (URL to visit your site) and Site Address (URL of your core files) with your new domain. Hit Save Changes once you’re done.
We’re not done just yet. Before re-accessing your site using the new address, complete the following remaining steps.
To reflect the changes you made in the WordPress settings, you have to edit the wp-config.php file. You can access it from the hPanel’s file manager or by using FileZilla. For this example, we’ll be using the hPanel:
Your wp-config.php file should look like this”
If you prefer using an FTP client, the process will be almost identical. You’ll just need to use the FTP account credentials to access the site’s files.
Next, you’ll have to update your WordPress site’s database:
The final step to change WordPress domain requires you to create a 301 redirect – a URL redirection from your old domain to the new one. Additionally, the redirect will carry over Google’s PageRank, making sure that all of your efforts put into SEO doesn’t go to waste when moving to a new domain.
We recommended keeping your old domain active for a while. This both allows users to find you if they’re not aware of the domain change and lets the search engines recognize the redirection.
Let’s dive into the hPanel to edit the .htaccess file and create a 301 redirect:
#Options +FollowSymLinks RewriteEngine on RewriteRule ^(.*)$ http://yoursitename.com/$1 [R=301,L]
Same as with the modifying wp-config.php, this step can be completed with an FTP client.
There are many reasons why you would want to change WordPress domain name. Luckily, WordPress provides a built-in URL address settings and allows you to manually tweak the PHP code through a file manager or an FTP client to effectively change your domain.
In this tutorial, you’ve learned the steps required to change your WordPress domain. Here’s a quick recap:
Give it a try and good luck!
December 23 2017
Hi, really very helpful article i want to say thank you very much for sharing this types of the article please keep updating us. Thanks
April 02 2020
I followed the instruction, but when hit save changed after step 2, my site disappeared. When I go back, wordpress tells me I have no site. So sad.
Replied on April 21 2020
Chrispin, make sure you follow all the steps until the end to complete the process. If all is followed correctly, your site will be running smoothly!