In my previous post I have explained about how to upload the wordpress site from local server to the live server. And, now its just opposite “How to download wordpress website to your local computer?” This will be very helpful for the developers like you who continuously looking for further theme development or the plugin development and don’t want to break the live site.
For this post, I have broken down into different steps as below:
Step 1: Copy your site files from your hosting server to your local server folder. For transferring files from hosting server you can use FileZilla.
Step 2: Login to your web hosting member area and go to the database section (look for the phpmyadmin) and export the database file. Once you downloaded the database log into your local phpmyadmin and create a new database there. After creating a new database import the database to your local server which you exported from your live web hosting.
After this we need to update the file called ‘config.php‘, 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.
Step 3: Now, we have to do configuration so that we can connect to the database and make the website live on our local server. For this, we need to run the SQL queries in local phpmyadmin section. So, open the phpmyadmin on localhost and execute the following queries (You need to select the SQL tab where you can paste the following query)
UPDATE wp_options SET option_value = replace(option_value, 'http://www.techonroad.com/,'http://localhost/yoursite' WHERE option_name = 'home' OR option_name = 'siteurl';
Now we need to fix the links of the pages and posts. Since, all the pages and posts have their live links associated with them we need to change them as well such as ‘http://www.techonroad.com/wordpress-website’ need to be changed to ‘http://localhost/yoursite/wordpress-website’
UPDATE wp_posts SET guid = replace(guid,'http://www.techonroad.com/','http://localhost/yoursite');
Now, run your localhost address on your browser and you can see the website on your screen. If you can’t see the website on your browser then there might be something wrong and follow the steps again.
I hope this post helped.