Copying a hosted WordPress installation to a local machine for development is a fairly common task for many web designers. I prefer to accomplish this task with the excellent WordPress Duplicator Plugin by Life in the Grid. However, the Duplicator plugin is often an inadequate solution for larger sites on a shared hosting platform – you may experience frustrating sever timeouts and other difficulties.
Sometimes old ways is best ways, so role up your sleeves and prepare to copy WordPress to WAMP server manually, just like developers did before the various WordPress migration plugins existed.
I found the following instructions on the WordPress forum, they were contributed back in 2012 by Sunny Johol and still work perfectly for WordPress 4.5.2 and WAMP with phpmyadmin 4.0.4. It you follow the steps exactly you should have no trouble copying a WordPress site to a local test server. If you follow the forum link above you may find these instructions can be modified to work with XAMP as well. Many, many thanks to Sunny for sharing his technique.
Notes:
Step 3 – Problem importing large database? Read this.
Steps 4, 5 and 6 – As in the examples below, be sure to leave the trailing slash off your urls.
- Copy your files from your webhost to your local server folder.
- On your webhost login to phpmyadmin and export your database (By Selecting your database and selecting the export tab and downloading to your computer)
- Log into your local phpmyadmin, create a new database and import the sql database into it by selecting the import tab and uploading your file.
- Once Uploaded we want to modify the database to reflect the new blog location being on the localhost. So we run the following SQL (Select the SQL tab and paste the following code):UPDATE wp_options SET option_value = replace(option_value, ‘http://www.hostedversion.com’, ‘http://localhost/testsite’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
- We now want to fix the urls of posts and pages. So we run the following SQL:UPDATE wp_posts SET guid = replace(guid, ‘http://www.hostedversion.com’,’http://localhost/testsite’);
- If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. So we run the following SQL to fix this issue:UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.hostedversion.com’, ‘http://localhost/testsite’);
- We want to now modify our wp-config.php file in our local server. Honestly, the easiest way to do this is to delete the wp-config.php file in your local server and then visit http://localhost/testsite in a browser.
- With the dialog message that comes up click the ‘Create a Configuration File’ button. Then click the ‘Lets Go’ button on the next screen.
- Fill in all of the fields:
Database Name: This is the name of the database in your local phpmyadmin
Username: This is your phpmyadmin username (usually root)
Password: This is your phpmyadmin username’s password
Database Host: This is usually localhost
Database Prefix: normally is wp_ unless someone has changed it manually. - Click Submit, the wp-config file will be created and everything should work on the local host.
0 Comments