How To Change Your WordPress URL
Last modified: February 4, 2020
It is not a great idea to change the WordPress URL, especially for an established site. It can cause significant challenges for your SEO, traffic and branding. However, there are times when you might legitimately need to change your URL (i.e. a required change of branding, new ownership, etc.). So follow these instructions your WordPress URL.
Step One: Backup
This is a complicated process. Therefore, you want to make sure that you have a backup of your WordPress before you start. You can do this manually or you can use a plugin.
Step Two: Change The URL Within Your WordPress Dashboard
The first task is to change the URL within your WordPress dashboard. This step comes with a big warning: once done, you won’t be able to access the backend of the website until the rest of the process is complete.
To start, log into your WordPress website and go to the ‘General’ and then ‘Settings’ screen.
From there, you want to go to your WordPress address and site address fields. Now just enter in the new URL into these fields and click on the ‘Save Changes‘.
This will now make your site temporarily inaccessible.
Step Three: Change The Domain In The wp-config.php File
Now you need to go and update your wp-config.php file.
To do this, open you FTP client and log in using your credentials (accessible from your hosting solution).
In the list of folders and files of your website, you need to looking for wp-config.php file. It is often in a file, normally a root file. This is a core document. It dictates how your WordPress website works and connects.
To edit the file, you can right click on the file and choose the option to View/Edit the file. This will open the file in a text editor. In this, you will need to add these two lines of code before the /* That’s all, stop editing! Happy blogging. */
Remember to change the example.com to your own domain name.
Once done, you can then save the file and it will save to your website’s server. This should also mean that your website is not working again.
Step Four: Setup Redirects
Now you have to clean-up the links that are embedded in your site referring to your old domain.
This can be done within the FTP again. You will need to find the .htaccess file. Within this file you will need to add the following code:
#Options +FollowSymLinks RewriteEngine on RewriteRule ^(.*)$ http://www.example.COM/$1 [R=301,L]
It might be best for you to make a backup of this file. If you make a mistake, your website can sometimes stop working.
Don’t Change Your URL If You Don’t Have To
The important thing is to not change your URL unless you have to. Be absolutely sure that the change is necessary and that there are no other options available.