We are in the right position on the bat not to change your domain name specifically to an established WordPress website – not recommended. However, there are valid reasons for doing so, and if required you want to work correctly.
Fortunately, the process is actually surprisingly simple if you are changing only the primary URL for your website. While you will need to change some settings in two different locations, dealing with each will be a breeze.
This post will look at how to change your domain name within WordPress, and will also touch on a few key points to do so successfully. let’s get started!
How do you change your domain name?
As we said, changing the domain name of your WordPress website is not something you should do lightly. However, when you find yourself in this situation, there are only a few steps involved in this process:
- Access your WordPress dashboard, and change your URL within Settings> General Screen.
- Update your wp-config.php file to reflect the changes.
- Check that the domain change is implemented correctly.
The process itself is relatively simple, although there are some aspects that require little technical knowledge. We will cover them in the next few sections, but don’t worry – we walk you through each step.
Changing your domain in wordpress
Before you bow your head to changing the domain name of your website, there are a few things to keep in mind. A little preparation is necessary, to ensure that the process goes as smoothly as possible. One mistake can bring down your entire website, but getting your resources and knowledge before you helps you avoid that scenario.
For example, you want to do a full backup of your website before lifting a finger. That way, if the worst happens, you can roll your changes back to a clean configuration and start over.
In addition, you will have to use the File Transfer Protocol (FTP) client for some of these steps. It is a way to access your server directly from your desktop, and although it is simple to use, it involves a learning curve. Like, you want to download a suitable client (we recommend FileZilla) and brush up on your FTP skills.
In addition, you will need your server credentials to log in via FTP. These can usually be found in the admin panel of your hosting provider.
Finally, we are assuming that you already have a purchased domain name, and you have prepared it by pointing to the correct nameserver. If not, you want to make sure that before you do anything else.
How to change your domain name
Now that the prep work is over, get down to business! To change the domain name of your WordPress site you need to follow three steps.
Step 1: Change your URL within WordPress
Your first task is to physically change the URL of your site within WordPress. However, this step comes with a warning word. When you save your changes, the back end of your site will not be accessible until you complete the rest of the process.
To get started, log into WordPress and go to the General> Settings screen:
This screen contains the global settings for your WordPress site. Areas we are interested in are WordPress address (URL) and site address (URL):
To change your URL, just type the new address in both these fields, and click Save Changes. As we mentioned, this will make your site temporarily inaccessible.
Step 2: Edit your wp-config.php file
Before you can access your site again, you will need to update your wp-config.php file to reflect the changes you have made. This is another reason why a full backup is important before starting this process.
Open FileZilla (or whatever FTP client you prefer), and log in by entering your credentials in the Host, Username, Password, and Port fields. Then, choose Quickconnect:
At this point you will see two list of folders. The ones on the right are the most important, because they are on your server. First, you need to find the root folder of your website, often called www or public_html, or named after your site. Then look for the wp-config.php file within that folder.
It is one of the core files of WordPress, which determines how your site works and how it connects to the web. To edit it, right-click on the file and choose View / Edit. This will open in the text editor of your choice:
Of course, you should replace the placeholder URL with your new address. Once you save your changes and upload the new version of the file back to your server, you should be able to access your site again, and change your domain! However, your work is not enough.
Here, you will need to add two lines to the file, right before / * all this, stop editing! Happy Blogging. * /:
Step 3: Set permanent redirects and notify search engines of changes
This last step is more than a ‘clean-up’ job. Even once your domain changes successfully, you have all your content and many links across the web that return to your previous address. Fortunately, you can permanently redirect those links to your new domain.
To do this, you’ll need to access your site via FTP once again, and look for the .htaccess file. This is another WordPress configuration file (so it is worth copying to your desktop as a backup before tweaking it). Within, you would like to add the following code:Again, the placeholder URL should reflect your new domain.
Once you do this, the final task is to tell Google that you have updated your domain. This process is straightforward within Google Search Console, and will only take a few minutes.
Get support for more common WordPress queries from Singh Bazar
Of course, a major task as changing your domain name requires you to trust your site – as well as your hosting provider. Singh Bazar is the market leader in reliable WordPress hosting, and what’s more, our support team is stellar!
There are many WordPress related tasks that you may not be sure how to approach, but help is at hand. We have a dedicated resource center on the roof with supporting articles (just like this), which you can access whenever you need it. Check it out today!