WordPress Transfer

Hi Experts,

Tomorrow I need to transfer a new WordPress site from my localhost to live, and I wanted to get some feedback on the easiest way to this, including design, content and settings?

In my mind I need to

1- Install WP Live
2 - From local export the db as .sql
3 - Within .sql search and replace http://localhost with http://www.domain.com, then replace the db on live site.
4 - FTP my parent and child theme
5 - FTP my content directory
6 - Install any plugins

Am I missing anything?

Thank you,
APD TorontoAsked:
Who is Participating?
 
Julian HansenCommented:
Here is the process I use

1. Install WP CLI

2. Create a backup of your DB (we are going to modify the local version so we want to be able to restore it).
mysqldump --databases LOCALDB -u LOCALUSER -p > LOCALDB.YYYYMMDD.sql

Open in new window

Enter LOCALPASS when prompted
WHERE:
   LOCALDB is the name of the database on your local machine - get from wp-config.php
   LOCALUSER is the name of the user for the above database
   YYYYMMDD is the date
   LOCALPASS is the password for the above user

Open in new window

3. Run the following WP CLI COMMAND in the ROOT folder of your WordPress site (same folder as your wp-config.php file)

  - Assume you access your local version as http://localhost/yourwpsite (change to what you actually use) and
  - Assume your target domain is www.yournewdomain.com then
wp search-replace --allow-root --url=localhost/yourwpsite localhost/yourwpsite www.yournewdomain.com

Open in new window

This will update your local DB with the production URL's

4. Dump your DB again (this is the version with the modified URL's we are gong to upload to the production server)
mysqldump --databases LOCALDB -u LOCALUSER -p > PRODDB.YYYYMMDD.sql

Open in new window

Enter LOCALPASS when prompted

5. Edit the PRODDB.YYYYMMDD.sql file and remove the CREATE DATABASE line and change the USE `XXXXXX` line to your online database name (replace the XXXXX with your online db name)

6. Upload the database to the server

7. Upload the files to the server (I usually ZIP the folder and upload the ZIP then extract in the Root folder on the server)

8. Edit your .htaccess file
Replace all instances of your local path with your new path. So if your local host was running off
http://localhost/yourwpsite and your online site is in the root domain then
Replace yourwpsite with blank for all instances in your .htaccess file

9. Update your wp-config.php file.
In the WP root folder on the Production server, edit the wp-config.php file and change the Database, User and Password values to the values for your online Database

10. Update your permalinks.
  - Logon to the wp_admin page
  - Go to Settings => Permalinks
  - Click the Save button

11. Restore your local DB to what it was

mysql -h localhost -u LOCALUSER -p

Open in new window

Enter LOCALPASS
Then at the MySQL prompt
use LOCALDB
source LOCALDB.YYYYMMDD.sql

Open in new window

Change
  LOCALUSER to your local user account
  LOCALPASS to the password for your local user account
  LOCALDB to the name of your local database
  LOCALDB.YYYYMMDD.sql to the name you used in step 2

Open in new window


You are done.
0
 
APD TorontoAuthor Commented:
Thank you!
0
 
Julian HansenCommented:
You are welcome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.