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 Website to a new server or host.
If you're moving your Website but using the same domain name, see Moving Large WordPress Websites to GoWebsite.
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 Move your WordPress Website to a different directory.
To get started, you need to set up WordPress on your hosting account. For more information, see Install WordPress. 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 Website.
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.
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 Create MySQL or MS SQL databases.
- 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 Restore MySQL database from another host.
To make your Website 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 Website. 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 Name
usernamehere
is your MySQL Database Name
yourpasswordhere
is your MySQL Password
localhost
is your MySQL Host Name
- Save your modifications.
Finally, you need to clean your Website of outdated link paths.
To Fix Broken Links After Moving Your WordPress Website
- 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 Website URL in the Search for field. For example, http://olddomainexample.com (no trailing slash).
- Enter your new Website 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');
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.