2

I am thinking, how might I setup a development server locally then when done, upload and sync files + data to test/production server? I think options like siteurl and home in wp_options database table will need to be changed, also, in wp-config.php some settings like database connection and debug mode will be different too.

1

It's quite difficult to keep data from a dev version in sync with data on the production site. But for an initial deployment, you are correct that it requires changes to wp-config.php and the database.

  • Install Wordpress on your dev machine, e.g. dev.example.com/blog/
  • Install Wordpress on your production machine, preferably with the same folder structure as the dev box, e.g. www.example.com/wordpress/
  • note: your wp-config.php settings will be different on production. That's fine, just maintain a safe copy of the file and do not overwrite.
  • Sync the /wp-content/ directory from dev to production (themes, plugins, etc)
  • Using PHPMyAdmin or similar, export the contents of your dev database to a text file
  • In the text file, replace any instances of the dev url with the production url (dev.example.com/wordpress/ => www.example.com/wordpress/). This will change the siteurl as well as any links to images in the posts
  • Using PHPMyAdmin or similar, import the contents of your dev database to the production database
  • Try accessing the Wordpress admin module in the production server - you should be good to go.

This technique works for me, but I'd love to hear of any cleaner migration techniques.

UPDATE: There are a number of techniques discussed in the following post, including a plugin that handles the db grunt work:
How to: Easily Move a WordPress Install from Development to Production?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.