Changing Your WordPress Domain Name While Moving Your Site to a New Location
There are different ways to move your WordPress site between servers. You should only use this method if you want to change the domain name your WordPress site is hosted on while you are moving the site.
You need to export your existing files and database, and then import the files along with the database on to the new site. Finally, to complete the process, you need to update your wp-config.php file and repair any broken links on your site.
1. Exporting and Downloading a WordPress site Away from a Server
To export and download WordPress sites from your current host, you need to back up your existing database and have access to the WordPress files on your existing server.
To Export and Download a Blog Away from a Server
- Identify the database (examine the wp-config.php file) that your WordPress blog uses, and then create a backup of your database as an SQL file. This can be done using the database Admin Panel's export facility. More from Wordpress.
- Connect to your existing hosting account using File Transfer Protocol (FTP).
- Download the entire contents of the sites folder to your computer.
2. Importing and Uploading a WordPress Site to a New Site
To import and upload your WordPress site to our servers, you need to access the new hosting server and database.
To Import and Upload a WordPress Blog to a New Location
- Connect to your new hosting account using FTP.
- Upload the sites folder you saved.
- Create a new MySQL database and database user. This can be done from the sites control panel.
- Note the database's Database Name, Database Host IP Address, Database Username and the password you used.
- Restore the
SQL
file you saved into your new database. This can be done using the control panel for the new database and the Import facility.
3. Updating Your wp-config.php File
To make your site work again, you need to update the wp-config.php
file with your new domain name.
To Update Your wp-config.php File
- Using your hosting control panels File editor, open your
wp-config.php
file. - Add the following two lines to the file, where example.com is the correct location of your site.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com'); - Locate the section that looks like this example:
/** The name of the database for WordPress */
define('DB_NAME', 'putyourdbnamehere');
/** MySQL database username */
define('DB_USER', 'usernamehere');
/** MySQL database password */
define('DB_PASSWORD', 'yourpasswordhere');
/** MySQL hostname */
define('DB_HOST', 'DBHostIP'); - Enter the database information from your database as follows:
putyourdbnamehere
is your MySQL Database Nameusernamehere
is your MySQL Database Nameyourpasswordhere
is your MySQL PasswordDBHostIP
is your MySQL Host IP Address
- Save your modifications.
4. Fixing Broken Links After Moving Your WordPress Site
Finally, you need to clean your site of outdated link paths.
To Fix Broken Links After Moving Your WordPress Site
- Log in to your WordPress admin panel.
- From the Plugins menu, click Add New.
- Enter Search and replace, and then click Search Plugins.
- Locate the Search and Replace plugin, and then click Install Now.
- Click OK.
- Click Activate Plugin.
- From the Tools menu, click Search and Replace.
- Enter your old site URL in the Search for field. For example, http://olddomainexample.com (no trailing slash).
- Enter your new site URL in the Replaced with field. For example, http://newdomainexample.com (no trailing slash).
- Select All, and then click Go.
- Using your hosting control panels File editor, open your
wp-config.php
file, and remove the following two lines:define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');