Changing Your WordPress Domain Name While Moving Your Site to a New Location
There are different ways to move your WordPress® blog between servers. You should only use this method if you want to change the domain name your WordPress blog is hosted on while you are moving the site to a new server or host.
If you're moving your site but using the same domain name, see Moving Your WordPress Site to Us from Another Host.
If you want to simply change your WordPress domain name, see Changing Your WordPress Domain Name.
If you installed WordPress in the wrong directory on your server, see Moving Your WordPress Site to a New Directory.
To get started, you need to set up WordPress on your hosting account. For more information, see Installing WordPress on Your Hosting Account. Once WordPress is set up, you need to export your existing blog and database, and then import it along with the database on to the new server. 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 Blog Away from a Server
To export and download WordPress blogs 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 that your WordPress blog uses, and then create a backup of your database as an SQL file. For more information, see the WordPress codex.
- Connect to your existing hosting account using File Transfer Protocol (FTP). For more information see What is File Transfer Protocol (FTP)?
- Download the entire contents of the wordpress folder to your computer.
2. Importing and Uploading a WordPress Site to a New Server
To import and upload your WordPress blog 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 and replace the contents of the wordpress folder you saved.
- Create a new MySQL database. For more information, see Creating MySQL or SQL Server Databases for Your Hosting Account.
- Note the database's Database Name, Host Name, and the password you used.
- Restore the
SQL
file you saved into your new database. For more information, see Restoring Third-Party MySQL Databases.
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 account's 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. For more information, see the WordPress codex.
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', 'localhost'); - Enter the database information from your database as follows:
putyourdbnamehere
is your MySQL Database Nameusernamehere
is your MySQL Database Nameyourpasswordhere
is your MySQL Passwordlocalhost
is your MySQL Host Name
- Save your modifications.
5. 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 account's 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');
NOTE: As a courtesy, we provide information about how to use certain third-party products, but we do not endorse or directly support third-party products and we are not responsible for the functions or reliability of such products. Third-party marks and logos are registered trademarks of their respective owners. All rights reserved.