add the following to the start of the php file:
- Duplicate the files in cpanel to a website.ext.test folder
- Export the database from the live website
- Create a new test database with a new user and password
- Edit the wp-config with new database, db user, password and unique keys and salts (generate using URL in config file)
- Import the database into the test database
- Run the SQL commands below on the new test database.
- Add a redirect in cpanel to send all non www addresses to www.newsite.ext
- Add a redirect in the .htaccess file in cpanel’s file directory to send the subdirectory to the test.newsite.ext address instead
- Change the WordPress settings > Privacy to block search engines
- Change the WordPress settings > General > Site title to include “test”
- Enable sign-in before viewing any pages by installing and activating ‘registered users only’ plugin.
- Disable the WordPress settings > Media > ‘Organize my uploads into month- and year-based folders’
- Select and change the WordPress settings > Permalinks > Custom Structure to ‘/%category%/%postname%/’
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-url.com', 'http://www.new-url.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-url.com','http://www.new-url.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-url.com', 'http://www.new-url.com');
(These SQL queries are sourced from: http://wordpress.org/support/topic/create-a-test-site)
If you are using Category Redirect to Post or Page plugin:
UPDATE `wp_cat_redirect` SET url = replace(url, 'http://www.uk-move.com', 'http://www.test.uk-move.com');
Update any hard coded menu items manually via the GUI WordPress interface. Most should be relative to the site’s root and not require updating.
Here’s some things I change/add on new WordPress installs:
- Upgrade to latest version
- Delete Hello Dolly and Askimet (unless it’s a personal site) plugins after each upgrade
- Settings>Media> Uncheck ‘Organize my uploads into month- and year-based folders’
- Settings>Discussion>Uncheck ‘Allow people to post comments on new articles’ (unless you want comments enabled)
- Settings> Permalinks>Custom Structure = /%category%/%postname%/
- Posts> Categories: Rename ‘Uncategorized’ category to ‘Uncategorised’
Here’s some things you shouldn’t forget to backup before you reformat your computer.
These are the firefox plugins I can’t live without…
I discovered there were limits on the size of cookies recently while trying to save search form data to a cookie. In the end I had to save each search form in to a single cookie as a delimited list (a kind of ad-hoc array). I hope this saves someone the time it took me to work out why my cookies were being deleted…
If you want to know how to get your “view source” to work again in IE read on. Continue reading