wordpress on local machine
September 4th, 2010

Setup wordpress on local xampp from production server

For a wordpress blogger, it is required to setup and sync blog on local machine for theme, widget and plugin development and customization. this article shows the steps to setup wordpress blog on local machine from production server.

Step 1: Download and Install XAMPP on your local machine and check it by browsing default URL(http://localhost).

Step 2: Create a new folder (Say brij) in the installed XAMPP’s htdocs folder and download all wordpress files from production server’s public_html folder (if your site is in main domain otherwise where wordpress is installed) to local brij folder using ftp client.

Step 3: Open phpmyadmin of production server and export database in sql file and import it in the local machine using phpmyadmin.

Step 4: Set HOME and SITEURL parameters in database.
Before going the steps, Make sure you have a backup for exported sql file.

1. Open your imported WordPress database in phpmyadmin.
2. All the tables in your database will appear on the screen.
3. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
4. Click on the small icon indicated as Browse.
5. A screen will open with a list of the fields within the wp_options table.
6. Under the field option_name, scroll down and look for siteurl.
7. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
8. The Edit Field window will appear.
9. In the input box for option_value, carefully change the URL information to the new address.
10. Verify this is correct and click Go to save the information.
11. You should be returned to your wp-options table.
12. Look for the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the > symbol to page through them.
13. In the input box for option_value, carefully change the URL information to the new address.
14. Verify this is correct and click Go to save the information.
15. Delete the folder wp-content/cache (this is a new folder added with WordPress 2.0).
16. That is it.

Step 5:
a. Look for the name of the table within your database used to hold your post information. Usually it is called wp_posts, but it may have been changed. Write it down.
b. Clicking the Browse icon or link, open the wp_posts table.
c. Look for the field that holds your post “guid“. It is usually called guid, but it may have been changed. Write it down.
d. Click the tab at the top for SQL.
e. Using the information you wrote down from above and the old and new URL addresses you wish to update or search and replace within your database, type in the following (CAREFULLY):

UPDATE wp_posts SET guid = REPLACE (
guid,
‘http://oldsiteurl.com’,
‘http://newsiteurl.com’);

Step 6: Open .htaccess file (in brij folder) and replace it with following content:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /brij/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /brij/index.php [L]
</IfModule>

# END WordPress

Replace brij with your foldername.

Step 7: Now run http://localhost/foldername and enjoy it.