How to move WordPress from One Domain to Another Domain

How to move WordPress from One Domain to Another Domain

WordPress has two parts the files and the database.

1. To backup the WordPress files go to your host, use Cpanel and go to File Manager usually in the public_html directory is the root of your site and select all files, right click to compress into a .zip file.

2. Then download the .zip file via File Manager.  Filemanager in Cpanel can be used if the backup file is less than 2GB, if greater than 2GB you will need to use FTP.

3. Then we need to get database, the name of the database we need to get is listed in the wp-config.php file in the root directory of the website.  Go to Cpanel under PHP MyAdmin is where you will find the database.  Make a note of the prefix of the tables inside the database.  In PHP MyAdmin select Export the database and do quick SQL backup, it will download a .sql file

With step 2 and 3 above you have successfully backed up your entire WordPress site files into a zip file and database into a .sql file

4. Upload the backup zip file into the root directory of the new site or new domain using File Manager in Cpanel and extract the files by right clicking on the file and selecting extract all.  Make sure the root directory is empty or old files are placed in a backup directory.  After extracting the files you can delete the backup zip file if you need the space on your server.

5. On the new domain go to mySQL databases. The new domain could be a different domain on the same server or a different server altogether. Create a new data base and then a new database user and assign that user all privileges to the new database. Keep the database password for the wp_config file.

6. In wp-config.php on the new server or new domain change the database credentials to those of the new database created in 5 above.

7. From cPanel go to MySQL databases phpMyAdmin find the newly created database – there should be no tables found in the new database.  Go to import and import the old SQL database with default settings. Check table prefix in newly imported database matches the table prefix in the wp_config file.

8. Last step is to update the URL in the wp_options table with the new domain name for site url and home name which are the first two entries in the table.

The /wp-admin credentials and login will be the same as on the old location now the same also. Occasionally you might get 404 errors on some pages, to fix this put the page or post into draft and then publish again.