This article describes how to change the domain name for an existing WordPress installation. You may need to do this, for example, if:
Before changing the domain (or making any other major changes, for that matter), it is a good idea to do a site backup. Then if anything goes wrong, you can restore the site to its previous state.
For information about how to back up WordPress, please see this article.
After you do a site backup, you are ready to change the site's domain settings in WordPress. There are several ways to do this; use whichever method is available or easiest for you.
The easiest way to change the domain name is to use the administration interface in WordPress. To do this, follow these steps:
Under General Settings, in the WordPress Address (URL) text box, type the new domain name:
In the Site Address (URL) text box, type the new domain name.
If the administration interface is inaccessible, or if you prefer working from the command line, you can use the WP-CLI tool to change the domain name. To do this, follow these steps:
wp search-replace 'old.example.com' 'new.example.com'
WP-CLI replaces all instances of old.example.com in the database with new.example.com.
If you are unable to access the WordPress administration dashboard, or if you don't want to use the command line, you can use phpMyAdmin to change the domain name settings in the database manually. For information about how to do this, please see this article.
Lastly, you should test the site to make sure everything works correctly. Be sure to look for any hard-coded URLs that may no longer function with the domain name change.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.