- Wordpress CMS v4.1.1
What?
A note to myself on how to create a development/test version of a production/live Wordpress CMS site.
Why?
I have a website sitting at a domain (eg. www.myexample.com), and I want to create an exact copy at a subdomain entitled "dev1" (eg. dev1.myexample.com).
How?
A quick copy from copy 1 (LIVE) to copy 2 (DEV):
- Backup all files in LIVE environment
- Delete any files in DEV except for "wp-config.php"
- Copy all files except for "wp-config.php" from LIVE to DEV
- Copy the salt and secret keys from LIVE\wp-config.php to DEV\wp-config.php
- Backup the database in LIVE environment
- Clear the database in DEV
- Copy database from LIVE to DEV
- Change database values: Navigate to wp_options table and change the two values
copyraw
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'my_database_name'); /** MySQL database username */ define('DB_USER', 'my_database_user'); /** MySQL database password */ define('DB_PASSWORD', 'my_database_password'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** * Authentication Unique Keys and Salts. */ define('AUTH_KEY', 'my_auth_key'); define('SECURE_AUTH_KEY', 'my_secure_auth_key'); define('LOGGED_IN_KEY', 'my_logged_in_key'); define('NONCE_KEY', 'my_nonce_key'); define('AUTH_SALT', 'my_auth_salt'); define('SECURE_AUTH_SALT', 'my_secure_auth_salt'); define('LOGGED_IN_SALT', 'my_logged_in_salt'); define('NONCE_SALT', 'my_nonce_salt');
- // ** MySQL settings - You can get this info from your web host ** //
- /** The name of the database for WordPress */
- define('DB_NAME', 'my_database_name');
- /** MySQL database username */
- define('DB_USER', 'my_database_user');
- /** MySQL database password */
- define('DB_PASSWORD', 'my_database_password');
- /** MySQL hostname */
- define('DB_HOST', 'localhost');
- /**
- * Authentication Unique Keys and Salts.
- */
- define('AUTH_KEY', 'my_auth_key');
- define('SECURE_AUTH_KEY', 'my_secure_auth_key');
- define('LOGGED_IN_KEY', 'my_logged_in_key');
- define('NONCE_KEY', 'my_nonce_key');
- define('AUTH_SALT', 'my_auth_salt');
- define('SECURE_AUTH_SALT', 'my_secure_auth_salt');
- define('LOGGED_IN_SALT', 'my_logged_in_salt');
- define('NONCE_SALT', 'my_nonce_salt');
- Search and replace any other occurrences in the `wp_options` database table (note: include `wp_postmeta` and `wp_posts` if you want images and attachments)
- Done
Sample Configuration PHP
Note that the following are sample values and just for myself to quickly modify a Wordpress configuration file.
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'my_database_name'); /** MySQL database username */ define('DB_USER', 'my_database_user'); /** MySQL database password */ define('DB_PASSWORD', 'my_database_password'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** * Authentication Unique Keys and Salts. */ define('AUTH_KEY', 'my_auth_key'); define('SECURE_AUTH_KEY', 'my_secure_auth_key'); define('LOGGED_IN_KEY', 'my_logged_in_key'); define('NONCE_KEY', 'my_nonce_key'); define('AUTH_SALT', 'my_auth_salt'); define('SECURE_AUTH_SALT', 'my_secure_auth_salt'); define('LOGGED_IN_SALT', 'my_logged_in_salt'); define('NONCE_SALT', 'my_nonce_salt');