Home » Categories » Managed WordPress » Advanced

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.

To get started, you need to set up 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

  1. 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.
  2. Connect to your existing hosting account using File Transfer Protocol (FTP).
  3. 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

  1. Connect to your new hosting account using FTP.
  2. Upload and replace the contents of the wordpress folder you saved.
  3. Create a new MySQL database..
  4. Note the database's Database Name, Host Name, and the password you used.
  5. Restore the SQL file you saved into your new database.

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

  1. Using your hosting account's editor, open your wp-config.php file.
  2. 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');
  3. 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');
  4. 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
  5. 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

  1. Log in to your WordPress admin panel.
  2. From the Plugins menu, click Add New.
  3. Enter Search and replace, and then click Search Plugins.
  4. Locate the Search and Replace plugin, and then click Install Now.
  5. Click OK.
  6. Click Activate Plugin.
  7. From the Tools menu, click Search and Replace.
  8. Enter your old site URL in the Search for field. For example, http://olddomainexample.com (no trailing slash).
  9. Enter your new site URL in the Replaced with field. For example, http://newdomainexample.com (no trailing slash).
  10. Select All, and then click Go.
  11. 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.

1 (3)
Article Rating (3 Votes)
Rate this article
  • Icon PDFExport to PDF
Related Articles
Change a WordPress email address in the database
Added on Tue, Nov 17, 2020
Open phpMyAdmin
Added on Tue, Nov 17, 2020
Check cross browser compatibility for WordPress
Added on Tue, Nov 17, 2020
View my database details
Added on Tue, Nov 17, 2020
Activate an integrated SSL
Added on Tue, Nov 17, 2020