A WordPress website may have initially been developed on your local development workstation and publish or you may be taking over the support agreement for a WordPress website and want to carry out some additional work. Either way you don’t want to be developing straight on the Live Server.
We’ll explain how you can move your Live WordPress Website to your local software development machine to continue development.
The steps to do this are as follow:
- Back up and download your existing website
- Back up and download the mySQL database
- Restore Live Database locally
- Run query to change URL in database
- Restore live site locally
- Change Live Site URL in Local URL Tables
- Put Live site files in loclahost folder
- Edit wp-config.php
- Test your website
Back up and download your existing website
The vast majority of Web Host use CPanel and this will greatly simplify the process of creating a back up of your website.
Login into CPanel and navigate to File Manager
We usually compress the entire public_html folder or whatever directory your WordPress site has been installed in.
Depending on the size of your WordPress file, you can either download it straight from the CPanel or you can connect to your FTP and download the compressed folder.
Back up and download the mySQL database
Login into your Live Websites phpMyAdmin and Export your your Database
You may need to change a few settings here, depending on your set up.
Restore Live Database locally
Login in to your local PhpmyAdmin (http://localhost/phpmyadmin) and create a database with the same name as your production.
Restore Live Database to locally
Navigate to you Import tab and import the database
Change Live Site URL in Local URL Tables
Got to the SQL tab in http://localhost/phpmyadmin and execute the following queries putting your website URL
UPDATE wp_options SET option_value = replace(option_value, 'https://threenine.co.uk', 'http://localhost') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET post_content = replace(post_content, 'https://threenine.co.uk', 'http://localhost'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://threenine.co.uk','http://localhost');
Put Live site files in localhost folder
Ensure your local host folder is empty
sudo rm -rf /var/www/html/*
move your tar file to this folder
sudo cp threenine.tar.gz /var/www/html/threenine.tar.gz
uncompress the file
sudo tar -xvzf /var/www/html/threenine.tar.gz
Change persmissions on the folder
sudo chown -R www-data:www-data /var/www/.
You will need to change the UserName and password for the database in your wp-config.php. We’ll we’ll use nano tesxt editor to the edit the file.
sudo nano wp-config.php
change your DB_USER and DB_PASSWORD to your local username and password.
A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.
Latest posts by Gary Woodfine (see all)
- How to run PHP Server with BrowserSync and Gulp - September 2, 2018
- How to change WordPress User Password in phpMYAdmin - July 28, 2018
- 8 Plugins you need for your WordPress Website 2018 - July 1, 2018