If you’re migrating your WordPress site to a new domain name (URL address) you’ll need to update the WordPress configuration.
The steps below detail the two ways two update WordPress when you’re changing domain names.
These steps are to be done after you configure the domain name to be accepted by your web server. If you are not sure if this has been done or do not know how to do this talk to your hosting provider.
Option 1: change domain names using wp-config.php
Please note, if you have the WordPress files in a sub-folder, for example domainname.com/wordpress but want users to access your site using domainname.com – you will need to set WP_HOME to the sub-folder and WP_SITEURL to the address for the website.
- Using FTP or your websites cPanel access, open the wp-config.php file in the root of your WordPress installation
- At the top of the file, below the <?php add the following code
-
define('WP_HOME','http://domainname.com'); define('WP_SITEURL','http://domainname.com');
- Replace ‘domainname.com’ with the new domain name for your website. You may also wish to add www. to the start to force WordPress to use www.
- Save the changes and try accessing your site from the new domain name.
- If the site does not load, try the old domain name first then the new one.
- The WordPress site should now be using the new address.
- Don’t forget to redirect traffic from your old address to your new address.
Option 2: change domain names using wp-admin
Please note, if you have the WordPress files in a sub-folder, for example domainname.com/wordpress but want users to access your site using domainname.com – you will need to set WordPress Address (URL) to the sub-folder and WordPress Site (URL) to the address for the website.
- Log into your wp-admin
- Browse to ‘Settings’ -> ‘General’
- Under ‘WordPress Address (URL)’ and ‘Site Address (URL)’ enter the new domain name
- Save the changes and try accessing your site from the new domain name.
- The WordPress site should now be using the new address.