When we launch a website, we usually do so thinking about the current needs of our digital project and not about its growth or transformation possibilities. Therefore, it is common that sometime after publishing your website in WordPress under a certain domain name you have the need to change to a new one.
Why change domain name in WordPress?
Change can be motivated by many reasons, although these three are usually the most common:
- SEO question
As you know, the domain influences the organic positioning that your website obtains in search engines. If you include relevant keywords in it, you will have a better chance that users will find you.
- Trademark issue
If your business has become part of another larger organization if you have made changes to your offer of products or services and that name no longer represents you … or simply if you are immersed in a rebranding process.
- Interest in using a new.TLD
It may be that at first a .NET or an .INFO will suffice, but when your website becomes more robust you may miss a more popular generic extension, such as .COM . Without a doubt, if your website or online store has an international presence, this is the option that interests you the most.
Change a domain in WordPress step by step
I wish there was an automatic and instantaneous way to do it, but the truth is that the process requires going step by step and it is advisable that you have a medium technical level of WordPress to be able to carry it out successfully.
Important: it is normal to suffer a small temporary decrease in your website traffic . You think that Google needs time to re-crawl and index the new URLs.
First, what we always tell you.
Before making any changes, it is essential to make a copy of your content to be able to make a quick backup in case of failure.
To do this, you can export the copy of the database from the Control Panel , using the phpMyAdmin tool, and later download the files via FTP using a client such as Filezilla.
If you prefer, you can contact our Support team and we will take care of making a copy of the content and storing it compressed so that you can download it more easily.
Another important step before making the domain change is to duly inform your users that changes are being made to your website . You can easily fix this using a maintenance plugin, such as Maintenance or WP Maintenance Mode .
If you prefer to do without plugins, you can create a file named “.maintenance” within the root of your WordPress. Of course, it will show your visitors an unfriendly WordPress default message, so it is not the best option in terms of appearance.
Domain change through plugins
There are plugins such as Better Search Replace or All in One WP Migration that you can help yourself to change your domain in WordPress.
In case you opt for any of them, it is very important that you make sure not to alter the GUID columns (in most plugins they are defined this way by default).
These values should never be modified in your WordPress posts, not even with the domain change, as they directly affect their behavior and directly impact the user experience.
For example, if your visits make use of an RSS client and are subscribed to your feeds, by altering the GUIDs columns they will begin to notice strange behavior in their RSS, returning to see posts already published a long time ago and surely already read.
Domain change manually
Here we explain the steps you have to follow to change the domain of your website in WordPress successfully.
Point your new domain to the server where your WordPress website is hosted.
For a domain to be associated with a hosting, it is necessary to point the DNS zones to the server where the web page or the mail is hosted, which is known as a DNS record . In dinahosting you can create DNS records directly from your Control Panel .
Check that the hosting responds to the new domain that you entered in step 1.
These two steps could be done before or after the URL change internally in WordPress depending on the selected method.
For example, if you are going to make the change using the aforementioned plugins, the change of associated domain of the hosting or change of DNS will surely have to be done at the end, to avoid problems in accessing the WordPress backend during the intervention.
Force the site to load under the new domain through the wp-config.php file
As a general rule, you should not have the site URL defined in the wp-config.php file, but it is always necessary to verify that you do not have directives such as:
define ('WP_HOME', 'http://domain.com');
define ('WP_SITEURL', 'http://domain.com');
If so, you would have to change the value to the new domain or, better, comment / remove those directives.
Change the domain in the database.
To do this, it is necessary to modify the domain value within the “siteurl” and “home” fields of the wp_options table (the table prefix may change, for example blog_options).
At major, our blog can store the domain name in other tables, so we can do a search in all tables via phpMyAdmin . Access phpMyAdmin> Databases> Search , tell us the domain name and go to Select all> Continue .
This search will return all the tables in which the domain name is defined, so we will have to modify it if necessary (note that the name may appear in the wp_posts table and we are not interested in changing it).
Another option is to use the Better Search Replace plugin, mentioned above, and replace all the results, but we advise you to carry out a search first with the Dry option of the plugin to make sure of the changes you are going to make.
Redirect to the new domain so there are no 404 errors.
If you are going to keep the previous domain in use or there is still time until it expires, you can redirect it to the new domain, thus avoiding 404 errors from possible previous visitors who stored a URL from your previous domain .
This can be done directly from the domain’s Control Panel, or if you do not contact our Support team so that we can help you to make the redirection in the most convenient way for your project.
Review the changes you have made.
It is very important to check that our website loads correctly after the change, including the URLs of the site, menus and posts.
It is not necessary that you review all of them, but a few to verify that everything is in order.
Check the robots.txt to make sure this file has no references to the old domain.
If you use a plugin to generate it, you will simply have to do it again to update the URLs but, if you have created the file manually, you will have to replace the old URL with the new one, generally in the “Sitemap” fields.
Update Google Analytics and Google Search Console
Once you consider that your page is displayed correctly and you do not detect errors with the new domain, it is time to tell Google that you have changed the name of the site. This can be done using the Google Analytics and Google Search Console tools within the Google Webmaster tools.
Update your URLs for social networks and those of the ads that you have active.
Taking advantage of the fact that we have made changes to our site and that we have the website under maintenance, it is essential to update all WordPress plugins, themes and core to the latest version , thus ensuring that we are protected before possible code vulnerabilities and improving the general operation of the site .
If you have not done it already, we recommend activating a security certificate in your hosting and setting the URL of the site using HTTPS from the general WordPress settings. With this you make sure that your website always works under HTTPS, which gives added security while improving the image for your visitors . Do not hesitate and contact our Support department to help you activate your SSL certificate.
Finally, remember to deactivate the maintenance plugin to be available online again.
If you do not want to face this process on your own, we encourage you to leave it in our hands. Contact us and we will send you a quote! As soon as you approve it, we can change the domain of your WordPress on the same day.