You can change your domain in WordPress in a number of ways, for example: through the admin panel, editing wp-config.php or functions.php files and even with the help of plugins. Remember that changing a website address is a delicate task that requires caution.
Choosing a good domain for your website or blog is critical, as it is your signature on the internet. It is not always required to have your company brand – in the case of a blog or news portal, for example – but it must be clear, memorable and informative.
Best of all is to choose the domain very carefully so that there is no need to change the domain in WordPress. However, many reasons may make this necessary, such as poor current address performance, changes in marketing strategy, brand changes, legal issues, among other things.
If this is your case, this post made for you. We will deal with the following:
- How to change the domain in WordPress?
- What precautions need to take when changing a website address?
Be sure to read this article before you start any of the above procedures, as you will need to do some additional tasks to ensure the integrity of your content and SEO work done with the previous domain.
Enjoy the tips and good reading!
How to change domain in WordPress?
If you don’t have much WordPress experience, you can call on support from your hosting or the company that manages your site to make the necessary changes, but this category of service is not always available.
The methods we present are not very complicated, but it is interesting to have some prior knowledge to execute them, otherwise the best thing to do is to ask the help of a skilled professional.
First of all, remember that the new domain must have already been purchased, pointed to your server, and added to your hosting. It is also desirable to perform a full backup of your database before making any changes to allow procedures to be reversible.
Here are 4 simple ways to change your domain in WordPress. Check out!
1. Change the domain through the admin panel
The most practical way to arrange for a domain to be changed is by making minor adjustments to the WordPress admin panel itself.
In the left sidebar, go to “Settings” , select the “General” option and enter the corresponding information:
- WordPress address (URL): This is the address used to reach your site;
- Website Address (URL): This is the path where your files are located in WordPress.
In general, both should match. Finally, simply save your changes and log back in with the new URL .
This procedure, however, only changes the site values. Therefore, it is a basic change that depends on other actions if you really intend to perform a full migration.
2. Edit wp-config.php
For those who want to make adjustments in the bud, there are also many ways to do so, and one of the simplest is to edit the wp-config.php file as follows:
define (“WP_HOME”, https://yourdomain.com ”) define (“WP_SITEURL”, https://yourdomain.com ”)
In this case, “WP_HOME” refers to the website URL, that is, the address your visitors see and type in their browser. But the “WP_SITEURL” refers to the WordPress address, that is, where the website files are.
However, this procedure, just like the previous one, only encodes site values and is therefore not the best fix, even though it is a good workaround.
3. Edit the functions.php file.
Another interesting way to arrange for a WordPress domain change is to edit the functions.php file .
Using an FTP client like FileZilla to access the database, simply copy the functions.php file, edit it in a simple text editor – such as Notepad – and enter the updated values back in the same place.
The change is to add the following two lines of code just below the starting line “<? Php ”.
update_option (“siteurl”, “https://yourdomain.com”) update_option (“home”, “https://yourdomain.com”)
Most FTP clients offer the “edit file” option for easy change. After performing the procedure, you may need to load the login or administration panel a few times.
If you can’t find a functions.php file , just create a new one using a text editor, name it with the name in question and upload it to the directory. In the file, you must add the tag “<? Php ” in the first line and the two lines cited below. It will look like this:
<? Php update_option (“siteurl”, “https://yourdomain.com”)https://yourdomain. with”) update_option (“home”, “https://yourdomain.com”)https://yourdomain. with”)
Finally, in either case, when the site is back up, remove these lines or the functions.php file to end the procedure.
4. Change domain with the help of plugins
The plugins are a plus point of WordPress. You can find tools for almost any type of procedure, but it is essential to check the file’s reputation and developer reliability before installing them on your site.
The procedures listed above are simple and sufficient to provide for a WordPress domain change, but if you prefer to leave this work to a plugin, a good suggestion is All in One WP Migration , although its free version is relatively limited.
What precautions are required when changing a website address?
This is probably the main question surrounding upgrading a domain in WordPress, and indeed some other tasks are needed to ensure your SEO efforts are not lost in a few clicks.
What we mean is that the procedures we have presented so far only modify the local files of your site and that is not enough. What we need to do now is let Google know that your site has a new address.
The general recommendation is that the change is made gradually and regular visitors to the site or blog are properly informed about the news. To finalize the post taking all your doubts, follow some guidelines to help you in this process.
Keep both domains coexisting until the new one consolidates
The transition from one domain to another may take some time, but it will all depend on how your visitors reach your pages. If you rely mostly on social networks to get traffic , for example, it’s probably easier to change. But with Google in mind, it’s good to hold the tips a little longer.
To avoid any frustration, keep both domains active until the new address is delivering satisfactory answers and your audience has understood the change. This will ensure your search authority.
Create a sitemap for the new domain
A sitemap, or sitemap, is the file Google uses to understand your site information , so it is critical that it be available in your database. To create a file like this in WordPress, you can use a tool like XML Sitemaps Generator or Google (XML) Sitemaps Generator .
However, in order for the search engine to be able to read your sitemap information, you will need to verify ownership of the new domain, a procedure that can be done through Google Search Console (the old WebMaster Tools) or with the help of Google Analytics.
Once domain ownership is verified, simply tell Google the directory where your sitemap is located.
Apply canonical tags
While your two domains are live, we need to tell Google which one is the top one, and we do that by applying a canonical tag, an Html snippet that should be inserted into the <head> of the site. See an example below:
<link rel = ”canonical” href = ”https://yourdomain.com” /> https://yourdomain. with ”/ >
But beware: this should be done on every page (Home, About, Contact Us, etc.), otherwise Google will always redirect to the same place. The advantage of the canonical tag is that it already transfers much of the authority from the old domain to the new one.
After completing this procedure, you should constantly return to the Search Console to check how many of your new URLs have been indexed on your site map. When the number exceeds 90%, it means that the new address is almost consolidated.
Redirect Pages (Redirect 301)
The big mistake for most WordPress domain-changing users is to start here before performing the above procedures. The point is that before fulfilling all the steps above, Google still did not understand the existence of the new domain.
All steps should be performed step by step so that your SEO work is not lost. Only at the end of the whole process should we configure page redirection, in this case, 30 Redirect guarantees permanent redirection.
Once this step is completed, your old site will no longer officially exist to make room for your new address. All correct and lossless!
Changing the domain in WordPress is not a complex procedure, but it does require some platform knowledge and some important precautions, and this is just one of the many features of this fantastic CMS.
WordPress offers real-world possibilities for building, customizing, and optimizing websites, and you and your business have a lot to gain from knowing this tool more closely.
Check out our WordPress Hosting page and find out how we can help you to speed up the load time of your website.