You would need is to back up your website manually.
Export your WordPress database. phpMyAdmin is recommend or your own choice
To export your live site’s WordPress database, you need to log into your cPanel dashboard and click on phpMyAdmin. Inside phpMyAdmin you need to select the database you want to export and then click on the export tab on the top.
phpMyAdmin will now ask you to choose either quick or custom export method. We recommend using custom method and choosing zip as the compression method. Sometimes WordPress plugins can create their own tables inside your WordPress database. If you are not using that plugin anymore, then the custom method allows you to exclude those tables. Leave rest of the options as they are and click on the Go button to download your database backup in zip format.
Once you have downloaded your database backup, the next step is to download your WordPress files. To do that you need to connect to your WordPress site using an FTP client like Filezilla. Download all your WordPress files and folder to your computer. Downloading all your files may take a while depending on how much data you have on your website.
After downloading your WordPress files, if you downloaded all your files and not just the wp-content directory then simply copy paste these files in your local server folder where you want to install WordPress.
On your local server, you need to create a database for your WordPress site. To do that you need to open http://localhost/phpmyadmin/ in your web browser and create a new database. After creating the database click on the Import tab on top. On the next screen you need to click on the Choose File button to select the WordPress database export file you downloaded earlier, and then click on the Go button. phpMyAdmin will now import your database and will show you a success message when it is done.
Now that your database is all set up, you need to update the URLs inside your WordPress database referencing to your live site. You can do this by running an SQL query in phpMyAdmin. Make sure you have selected your local site’s database and then click on SQL. In phpMyAdmin’s SQL screen copy and paste this code, make sure that you replace example.com with your live site’s URL and localhost/test-site with the local server URL of your site.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'http://localhost/test-site') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.example.com', 'http://localhost/test-site');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.example.com','http://localhost/test-site');
This query will replace refences to your live site’s URL from database and replace it with the localhost URL.
The final step is to update your local site’s wp-config.php file. You need to go to the folder where you installed WordPress on your local server and open wp-config.php file in a text editor like Notepad. Replace database name with the one you created in phpMyAdmin on your localhost. Replace the username with your local mysql username, usually it is root. If you have set password for mySQL user root on your localhost, then enter that password. Otherwise leave it empty and save your changes.
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');
/** MySQL database username */
define('DB_USER', 'username_here');
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
That’s all your live site is now copied to your local server, and you are ready to test drive it.
Export your WordPress database. phpMyAdmin is recommend or your own choice
To export your live site’s WordPress database, you need to log into your cPanel dashboard and click on phpMyAdmin. Inside phpMyAdmin you need to select the database you want to export and then click on the export tab on the top.
phpMyAdmin will now ask you to choose either quick or custom export method. We recommend using custom method and choosing zip as the compression method. Sometimes WordPress plugins can create their own tables inside your WordPress database. If you are not using that plugin anymore, then the custom method allows you to exclude those tables. Leave rest of the options as they are and click on the Go button to download your database backup in zip format.
Once you have downloaded your database backup, the next step is to download your WordPress files. To do that you need to connect to your WordPress site using an FTP client like Filezilla. Download all your WordPress files and folder to your computer. Downloading all your files may take a while depending on how much data you have on your website.
After downloading your WordPress files, if you downloaded all your files and not just the wp-content directory then simply copy paste these files in your local server folder where you want to install WordPress.
On your local server, you need to create a database for your WordPress site. To do that you need to open http://localhost/phpmyadmin/ in your web browser and create a new database. After creating the database click on the Import tab on top. On the next screen you need to click on the Choose File button to select the WordPress database export file you downloaded earlier, and then click on the Go button. phpMyAdmin will now import your database and will show you a success message when it is done.
Now that your database is all set up, you need to update the URLs inside your WordPress database referencing to your live site. You can do this by running an SQL query in phpMyAdmin. Make sure you have selected your local site’s database and then click on SQL. In phpMyAdmin’s SQL screen copy and paste this code, make sure that you replace example.com with your live site’s URL and localhost/test-site with the local server URL of your site.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'http://localhost/test-site') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.example.com', 'http://localhost/test-site');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.example.com','http://localhost/test-site');
This query will replace refences to your live site’s URL from database and replace it with the localhost URL.
The final step is to update your local site’s wp-config.php file. You need to go to the folder where you installed WordPress on your local server and open wp-config.php file in a text editor like Notepad. Replace database name with the one you created in phpMyAdmin on your localhost. Replace the username with your local mysql username, usually it is root. If you have set password for mySQL user root on your localhost, then enter that password. Otherwise leave it empty and save your changes.
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');
/** MySQL database username */
define('DB_USER', 'username_here');
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
That’s all your live site is now copied to your local server, and you are ready to test drive it.
No comments:
Post a Comment