1. Log into your cPanel or hPanel account.
2. Navigate to the “Domains” section.
3. Select the domain you want to change.
4. Click the “Change Domain Name” button.
5. Enter the new domain name and click “Save”.
6. Log into your WordPress dashboard.
7. Navigate to the “Settings” tab.
8. Select the “General” option.
9. Enter the new domain name in the “WordPress Address” and “Site Address” fields.
10. Click “Save Changes”.
11. Log out of your WordPress dashboard.
12. Log back into your WordPress dashboard using the new domain name.
13. Navigate to the “Settings” tab.
14. Select the “Permalinks” option.
15. Click “Save Changes”.
Your domain name has now been successfully changed on your WordPress website.
As businesses start offering new products or services, or entering new markets, changing the business strategy might become inevitable. This includes aligning your domain name with your brand value.
In addition to providing a readable address, a domain name is the unique address for a website and it also represents your brand. With that in mind, the domain should reflect your brand’s goals and missions.
Fortunately, changing a domain name is a straightforward process. This article will show you how to do so for a WordPress site.
How to Change Domain Name on WordPress
1. Purchase and update your new domain name
2. Update the WordPress Address and Site Address fields
3. Update the database to reflect the new domain name
4. Update some themes and plugins that may contain hardcoded URLs
5. Test your site to ensure that everything is working correctly
Watch Our Video Tutorial – How to Change Your Domain Name In WordPress
Tired of reading? watch our video tutorial instead and find out how to change your domain name in WordPress step-by-step.
Subscribe For more educational videos!
Hostinger Academy
Things to Do Before You Change Your Domain Name
Be sure to follow these prerequisites before proceeding to change your domain name in WordPress.
1. Backup Your Current Site
Back up your website before making any big changes. Doing so will allow you to get your site back whenever an error occurs. Otherwise, you risk losing all your data and having to start from scratch.
A WordPress website consists of two main components – website files and databases. Hence, before transferring your site content onto the new domain, execute a full backup of your entire site.
For Hostinger users with shared hosting or cloud server hosting services, we offer a one-click restore and backup system to backup your WordPress site via the hPanel dashboard.
Alternatively, several WordPress plugins enable you to perform a backup with just a few clicks. Some of the most popular choices are VaultPress, UpdraftPlus, and BackWPup.
2. Access to a Hosting Dashboard or an FTP Client
If you want to change the WordPress domain, you’ll need access to your hosting account dashboard – this is where you will add your new domain address. Hostinger users can log into the hPanel dashboard and head to the Domain section for domain management.
Alternatively, use an FTP client to upload your site backup. To do so, you will need to configure FileZilla Client beforehand. Once everything is set, you can upload and manage larger files remotely from a local computer.
3. A New Domain Name
Make sure to do proper research before buying a new domain name, from finding a credible hosting registrar to deciding a suitable extension for your site address. Many people are using .com domain names for their website names. A good rule of thumb is to make a list of potential domain names and check their availability via a domain name finder.
Now, if you have all the prerequisites ready, it’s time to take action. The following section will walk you through the easy methods of changing your WordPress site address.
How to Change Domain Name in WordPress
For the most part, the steps to change the WordPress domain are simple, but some tasks will require you to tweak your site’s PHP code. Modifying the code might put your site at risk when done wrong.
1. Purchase a New Domain Name
First, head to Hostinger’s domain checker and type in your preferred domain. You’ll find out if this option is available, and get some suggestions on alternative domain names as well as their costs.
Domain Name Checker
Instantly check domain name availability.
If your desired domain name and its alternatives are already taken, try contacting the domain owner and negotiate a fair price for that particular domain. Use the domain lookup tool to find who owns the domain along with the owner’s information, such as phone number and email address.
However, if your desired domain address is available, simply add the domain to the cart, and proceed to check out.
During the checkout process, you will also need to specify the domain registration period. There are several registration periods, ranging from one to ten years. However, most domain registrars will require you to pay for at least one year.
At Hostinger, we offer up to a three years registration period. If you purchase Hostinger’s annual Premium or Business shared hosting plans, you will get a free domain for the first year and free WHOIS privacy protection.
Proceed to click the Checkout Now button to finalize your order.
2. Add the New Domain Name and Upload the Backup
The next step is adding the new domain name to your existing hosting plan. Below, we will go over the steps of doing so on both hPanel and cPanel.
Using hPanel
- Navigate to Website → Add Website on your hPanel’s left sidebar.
- Then, select Skip, create an empty website at the bottom of the screen, as we will copy and paste the website files later.
- Pick your purchased domain name from the drop-down menu in the Choose a Domain section. Then, click Select.
- Fill in the domain owner’s contact details. If you don’t have a domain owner profile, you can add a new one by following the instructions.
- Go back to the hPanel dashboard once you’re finished. You may see a warning saying that the domain is not connected to Hostinger. This is normal, as DNS changes take time to propagate.
Using cPanel
- Log into your cPanel account, navigate to Domains -> Addon Domains.
- Under the Create an Addon Domain section, fill out the new domain address. The subdomain and the document root will get filled automatically.
- If you want to create an FTP account for the new addon domain, simply check the Create an FTP account associated with this Addon Domain box. Doing so will bring up additional settings, such as username and password.
- Once you have filled in all settings, click Add Domain.
Keep in mind that addon domains will not work unless you add the correct DNS records. One of the most efficient ways to look for DNS records is to use the nslookup commands.
Alternatively, you can use an online DNS checker to find different types of DNS records.
3. Copy All WordPress Core Files From Your Old Domain
Moving all website content from your old site to the new domain is easy with the help of backup. Especially, when you don’t switch to a new hosting provider.
Download your backup file from the hosting dashboard or directly copy your old domain folder to the new one.
Below, we will walk you through the steps of moving your website content to a new domain via Hostinger’s File Manager. Before applying the following steps, ensure that your add on domain is successfully added to your account.
- Access your hPanel dashboard and navigate to Files -> File Manager.
- Check whether you have both domain folders in the File Manager.
- Click on the domain folder you want to move your content from, and open the public_html directory.
- Select all files – click on the Copy button if you want to leave a copy of the files on the old domain name. Otherwise, click Move to completely transfer all content to your new WordPress address.
- Clicking on either option will trigger the following pop-up window.
- Click Change and specify the path to your new domain folder. In this example, it should look like this: domains/newdomain.tld/public_html
Meanwhile, if you’re switching hosting, you will need to download your backup and upload it via the cPanel’s File Manager or an FTP client. Then, import your database via phpMyAdmin and update the WordPress configuration file. Doing so will keep both of your sites online.
4. Change the URL and Site Address
The next step of changing your WordPress address is to update the existing URL and site address. This helps provide a smooth user experience for your visitors and makes it easier for web crawlers to find and index content.
There are several options to do so, from accessing your WordPress admin dashboard to updating your WordPress database via phpMyAdmin. Let’s go over the methods one by one.
1. Use the WordPress Admin Dashboard
The first and most common method is to add your new address to the WordPress General Settings. Do this by going to Dashboard -> Settings -> General. Then, replace your current WordPress Address (URL) and Site Address (URL) with your new URL.
Ensure that both addresses match unless you’re setting a designated home page for your WordPress site. Once done, click Save Changes.
However, those fields might be grayed out due to set fixed values in your wp-config file. In this case, follow the steps in the section below.
2. Via the wp-config.php File
To reflect the changes in the WordPress settings, you will have to edit the wp-config.php file.
The wp-config file is usually located under the root directory of your WordPress site – simply access it through the hPanel’s file manager. Alternatively, open it via FTP, SSH, or WP-CLI.
In this example, we will show you how to edit the wp-config.php file in the hPanel dashboard:
- Head to hPanel -> Files -> File Manager.
- Choose the domain folder and click Go to File Manager.
- Locate the wp-config file in the public_html folder.
- Right-click and select Edit.
- In the following code, replace http://yoursitename.com with your new site URL:
define('WP_HOME','http://yoursitename.com'); define('WP_SITEURL','http://yoursitename.com');
- Insert it into the file and press Save & Close. 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 files.
3. From the Database Using phpMyAdmin
Another option to choose when changing your WordPress address URL is to directly edit the database in phpMyAdmin. To do so, follow these steps:
- Navigate to hPanel -> Databases -> phpMyAdmin.
- Choose the database where your WordPress files are located and click Enter phpMyAdmin.
- On the phpMyAdmin page, find the wp-option file.
- Select Edit on the site URL and home rows.
- Replace the old URL with your new site address URL and press Go. The system will automatically save changes.
5. Reset URL Structure
Now that you have changed your site address and URL, the next step is to update your URL structure. If you keep the same structure, the posts and pages might show the 404 error whenever visitors try to access them.
This error happens when the server cannot fetch requested posts or pages due to missing resources. Therefore, it is important to modify the site address URL structure to make your content accessible to your visitors.
There are several ways to reset your URL structure:
Reset Permalinks via the WordPress Dashboard
To do this, log in to the WordPress dashboard and go to Settings -> Permalinks.
By default, WordPress uses the Plain permalink structure. However, this structure doesn’t contain any information about your content, making it the least ideal option for SEO.
Other URL structure options are as follow:
- Day and name – includes the full publishing date as well as the post name.
- Month and name – displays the month and year along with the post name.
- Numeric – uses the post ID written in numbers.
- Post name – shows the post slug in the URL.
- Custom structure – allows you to customize what goes into your site URL with available tags, such as author and category.
The post name option is arguably the best URL structure since it’s short and straightforward. However, feel free to choose the permalink structure as you need. By resetting broken permalinks in WordPress, the system will automatically redirect visitors from your old site to your new address.
Search and Replace
Another way to edit the WordPress URL structure is by using your database’s search and replace command. Replace the value carefully since these changes will be irreversible.
If you’re not comfortable with coding, perform this action is by using a plugin. We will show you how to do so with Better Search Replace.
Before we get into the steps, install the plugin. Now, let’s get started:
- From your WordPress admin dashboard, go to Tools -> Better Search Replace.
- On the Search/Replace, add the text string you want to search for and then add the replacement.
- Next, select the database table you want to modify. It is also possible to select multiple tables.
- If you want to review changes in your database before applying them, simply tick the Run as dry run? button.
- Once everything is set, click Run Search/Replace.
6. Redirect an Old WordPress Domain Permanently
The final step when changing the WordPress domain is to create a 301 redirect – a URL redirection from your old domain to the new one. The redirect will carry over page ranking values, ensuring that your SEO efforts won’t be lost when moving to a new domain.
We recommend keeping your old domain active for a while. This will allow users not aware of the domain change to reach the site and help notify search engines about the redirection.
Let’s dive into the hPanel to edit the .htaccess file and create a 301 redirect:
- Go to hPanel -> Files -> File Manager.
- Select your old domain and click Go to File Manager.
- Find the .htaccess file in the public_html directory.
- Right-click and choose Edit.
- Replace http://yoursitename.com with your new domain, and insert the following code.
#Options +FollowSymLinks RewriteEngine on RewriteRule ^(.*)$ http://yoursitename.com/$1 [R=301,L]
- Press Save & Close.
Similar to modifying wp-config.php, you can complete this step with an FTP client.
Why Change Your Domain Name
Generally, most businesses and companies stick to their initial domain name and build their marketing strategies around it. However, sometimes changing a domain name is necessary.
Here are the most common reasons:
- Rebranding – whether for new management or a new target audience, sometimes businesses need to be rebranded. A site address is one of the most important business identities, so you should align it with your new brand.
- Domain extension change – if you’re using an industry-specific subdomain like .shop or a country-code extension like .uk or .co.uk domain and want to use a more generic one, swapping to a new domain name extension like .com, .net, or .online TLD might be a great idea.
- Create a user-friendly site URL – the simpler a domain name, the more memorable. Perhaps your old domain has complicated characters. In this case, change it to a more user-friendly address. A good rule of thumb is to keep it around 12 characters.
- Merging multiple domains – maybe your old domain name has already gained authority, and you want to merge it with your new domain. Merging domains lets you garner SEO benefits and link juice from the old website. It also helps with consistent branding and makes it easier to improve your SEO efforts.
No matter the reason, changing a domain name has its own pros and cons. For example, a domain change can decrease web traffic and lower page rankings.
This is because Google and other search engines will need time to crawl and index content on your new site address. As long as you implement the best WordPress SEO practices, you should be able to gain positions in the search engine result pages.
Pro Tip
Do not postpone changing your domain name. The sooner you do this, the smaller the risk of losing your SEO values.
Conclusion
There could be many reasons to change the WordPress domain name. Luckily, WordPress provides built-in URL address settings. This functionality allows you to manually tweak the PHP code through a file manager or an FTP client to change your domain effectively.
In this tutorial, you’ve learned the steps required to change your WordPress domain. Here’s a quick recap:
- Purchase a new domain name and register it.
- Add the new domain name and restore your site’s backup.
- Copy all core files from your old domain.
- Change your URL and site address in the WordPress settings.
- Reset the URL structure.
- Tweak the .htaccess file to redirect visitors and search engines to your new domain.
There are a lot of steps involved when changing your WordPress domain. With the correct implementation, you won’t lose any SEO benefits either. Whichever method you end up using, we recommend following best SEO practices to ensure that your new domain will rank high on the SERPs.
How to Change Domain Name on WordPress: Using cPanel and hPanel
Changing the domain name of your WordPress website can be a daunting task, but it doesn’t have to be. With the help of cPanel and hPanel, you can easily change the domain name of your WordPress website in just a few simple steps.
Step 1: Log into cPanel or hPanel
The first step is to log into your cPanel or hPanel account. This is the control panel for your web hosting account. Once you are logged in, you will be able to access the settings for your domain name.
Step 2: Change the Domain Name
Once you are logged into your cPanel or hPanel account, you will need to locate the domain name settings. This will usually be located in the “Domains” section. Once you have located the domain name settings, you will need to enter the new domain name that you would like to use for your WordPress website.
Step 3: Update the WordPress Settings
Once you have changed the domain name in your cPanel or hPanel account, you will need to update the WordPress settings. This can be done by logging into your WordPress dashboard and navigating to the “Settings” tab. Once you are in the settings tab, you will need to update the “Site Address” and “WordPress Address” fields with the new domain name.
Step 4: Update Your DNS Settings
The final step is to update your DNS settings. This can be done by logging into your domain registrar’s account and navigating to the DNS settings. Once you are in the DNS settings, you will need to update the A record and CNAME record with the new domain name.
Conclusion
Changing the domain name of your WordPress website can be a daunting task, but it doesn’t have to be. With the help of cPanel and hPanel, you can easily change the domain name of your WordPress website in just a few simple steps. Just remember to update the WordPress settings and your DNS settings after you have changed the domain name in your cPanel or hPanel account.