GoDaddy Help

Change my WordPress domain name while moving my 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 to a new server or host.

Note: If you want to simply change your WordPress domain name, see Change a domain in WordPress.

To get started, you need to set up WordPress on your hosting account. Once WordPress is set up, you need to export your existing site and database, and then import it along with the database onto 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.

Export and download your site away from a server

To export and download your WordPress site from your current host, you need to back up your existing database and have access to the WordPress files on your existing server.

  1. Identify the database that your WordPress site uses, and then create a backup of your database as an SQL file. For more information, see the official WordPress documentation.
  2. Connect to your existing hosting account using File Transfer Protocol (FTP). For more information see What is FTP?
  3. Download the entire contents of the wordpress folder to your computer.

Import and upload a WordPress site to a new location

To import and upload your WordPress site to our servers, you need to access the new hosting server and database.

  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 (cPanel / Plesk).
  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. For more information, see Import SQL files into a MySQL database.

Update 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.

  1. In the FTP app, open your wp-config.php file.
  2. Add the following two lines to the file, where is the correct location of your site. For more information, see the official WordPress documentation.
  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');
    $table_prefix  = 'yourtableprefix';
  4. Enter the database information from your database as follows:
    • putyourdbnamehere: Replace this with your MySQL Database Name.
    • usernamehere: Replace this with your MySQL Database Username.
    • yourpasswordhere: Replace this with your MySQL Password.
    • localhost: Replace this with your MySQL Host Name.
    • yourtableprefix with the correct table prefix.
      Note: If your site is hosted on Managed WordPress, the row with the hostname should have the following structure: define('DB_HOST', 'yourhostname:portnumber'); You should replace yourhostname with the correct MySQL host name and portnumber with the correct port number.
  5. Save the updated wp-config.php file.

Fix broken links after moving your WordPress site

Finally, you need to clean your site of outdated link paths.

  1. Sign in to WordPress.
  2. From the Plugins menu, select Add New.
  3. Type Better Search Replace.
  4. Find the Better Search Replace plugin and select Install Now.
  5. When the plugin has installed, select Activate.
  6. From the Tools menu, select Better Search Replace.
  7. Enter your old site URL in the Search for field. For example, (no trailing slash).
  8. Enter your new site URL in the Replace with field. For example, (no trailing slash).
  9. Select all database tables from the Select tables field.
  10. Uncheck the Run as dry run checkbox.
  11. Select Run Search/Replace to replace the URLs in the database.
  12. In the FTP app, open your wp-config.php file, and remove the following two lines:

You successfully changed your domain name and moved your site to a new server or host.

More info

Share this article