In this article we’ll explain how you can change the domain your WordPress website is using.
Before you start please ensure you have completed the following:
- Register your new domain name
- Add your domain to your Ecenica web hosting. See How-to add a Domain Alias
Steps to change the domain your WordPress website uses
- Login to your WordPress Dashboard
- For help accessing your WordPress Dashboard see How do I Login to my WordPress Dashboard.
- From the left menu click Settings > General
- Change WordPress Address (URL) and Site Address (URL) to your new domain.
- Scroll down and click the blue Save Changes button.
How to use WP-CLI to update WordPress post content to use the new domain
- Log in to cPanel.
- For help accessing your cPanel see Where do I log in to my hosting control panel.
- Click Terminal
- Navigate to the directory your WordPress website is in. For example, for your primary domain it would be the public_html directory:
cd public_html
Addon domains would be under a different directory you chose when creating your addon domain.
cd addondomain.com
- Run the following command. The ‘dry-run’ flag will not make changes.
wp search-replace 'www.olddomain.com' 'www.newdomain.com' --dry-run
- If you are happy, remove ‘dry-run’ by running the command below.
wp search-replace 'www.olddomain.com' 'www.newdomain.com'