There are a few backup/etc plugins out there will help you transfer a site from one domain to another or from a development site to your production site. I roll my own here and use the following steps:

  1.  Backup the files of the site. If you can SSH into the server, you can run this command from the root directory. Or just download all of the files over FTP.
    1. # tar cfvz mysite.tar.gz *
  2. Backup the database of the site. Do an export from phpMyAdmin, use a plugin like “WP DB Backup”, or run this from the command line:
    1. # mysqldump -u{db user} -p{db pass} -h{db host} {db name} > mysite.sql
  3. Upload the files to the new server. If you upload the tar.gz file from step 1, you can untar it like
    1. # tar xfvz mysite.tar.gz
  4. Create a new database on the new server.
  5. Import the DB backup. Again you can use something like phpMyAdmin or upload your .sql file to the server and run this line from the command line:
    1. # mysql -u{db user} -p{db pass} -h{db host} {db name} < mysite.sql
  6. Update wp-config.php in the root folder to point to the new DB location/name/user/pass.
  7. Create a file searchreplacedb2.php from this script on GitHub.
  8. Navigate to /searchreplacedb2.php on the new domain. Follow the instructions to select all DB tables.
    1. Search for olddomain.com
    2. Replace with newdomain.com
  9. Your site should work great now when navigating to newdomain.com.
  10. Delete the searchreplacedb2 file and any of your .tar.gz or .sql files from the server. (Or move them outside of the site root so they can’t be downloaded or executed.)

This entry was posted by Jason Coleman in General and tagged . Bookmark the permalink. Last updated: July 20, 2013. Titled How I Move Sites From One Domain to Another Using searchreplaceDB2.php

Leave a Reply

Your email address will not be published. Required fields are marked *