Do you want to move an online WordPress website to your computer's local server?

Installing WordPress on your computer (local server) makes it easy for you to learn WordPress and test things out. When you move an online WordPress website to a local server, it allows you to experiment with the same data as your live website.

In this article, we're going to show you how to easily move an online WordPress website to a local server without breaking anything.

But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog 

Then back to why we are here.

Why and who would want to move an online WordPress website to a local server?

If you have been running a WordPress website for a while, you can try new themes or plugins on it. However, if you do this on a website that is already live, it may result in a bad User experience for your users.

To avoid this, many users create a copy of their WordPress website on a local server to test new themes, plugins, or do development testing.

This allows you to set up your theme with all of your content and test all functionality without worrying about breaking your website. Many users copy their site to a local server to practice their WordPress and coding skills with the actual data from the website.

While you can do all the tests with dummy content in WordPress, the actual data from the website gives you a better visual representation of how those changes will appear on the website.

Preparing to move an online website to a local server

First of all, you need to make sure that you always back up your WordPress website. There are several major WordPress backup plugins that you can use.

Second, you need to install a local server environment on your computer. You can use XAMPP for Windows and MAMP for Mac. Once you have set up the environment, you need to create a new database using phpMyAdmin.

Just visit the following URL in your browser to launch phpMyAdmin.

http://localhost/phpmyadmin/ http://localhost:8080/phpmyadmin/

From there you have to click on the tab 'Databases'and create a new database. You will need this database to manipulate your website data online.

how to create the database on phpmyadmin

You are now ready to move your online WordPress website to a local server.

Method 1. Move the live website to a local server using a WordPress plugin

This method is easier and recommended for all users.

The first thing you need to do is to install and activate the plugin Duplicator. For more details, see our step-by-step guide on how to install a WordPress plugin.

Duplicator allows you to easily create a duplicate package of your entire website. It can be used to move your WordPress website to a new location, and can also be used as a backup plugin.

Upon activation, the plugin adds a new menu item "Duplicator" in your WordPress admin sidebar. Clicking on it will take you to the plugin packages screen.

how to create packages with the WordPress Duplicator plugin

To create a new package, you must click the Create New Package button. Duplicator starts the Package Wizard, and you must click the Next button to continue.

how to create packages with the WordPress Duplicator plugin step 2

The plugin will run a scan of your website and run some background checks. He will then show you a summary of those checks. If all looks good, click on the “Build” button to continue.

how to create packages with the WordPress Duplicator plugin step 3

Duplicator will create your website package.

When completed, you will see an archive zip file that contains all of your website data and an installer file. You need to download both files to your computer.

how to create packages with the WordPress Duplicator plugin step 4

You are now ready to install these files on your local server.

First, you need to create a new folder in the root folder of your local server. This is the folder where your local server stores all the websites.

For example if you are using MAMP then it will be in / Applications / MAMP / htdocs /. Otherwise if you are using XAMPP then it will be in C: xampphtdocs.

Inside this folder, you can create new folders for each new website that you want to import or create on your local server.

After that you need to open the folder you created for your local website and then copy and paste both the archive zip file and the installer script you downloaded earlier.

copy files to local website directory

To run the installation you need to run the installer.php script in your web browser.

For example, if you placed both files in the monsitelocal folder, you will access them in your browser by visiting.

http://localhost/mylocalsite/installer.php

You will see this Duplicator installation script:

installation of saved website with duplicatorClick on the button Next to continue.

Duplicator will unzip the archive and ask you to enter your local website database information. This is the database you created earlier.

installation of the database with duplicator

The server name is almost always localhost and username root. In most cases, your local server installation does not have a password set for root, you can therefore leave this field empty.

At the bottom of the page, you will see a button " Test DatabaseWhich you can use to make sure that the information in your database is correct.

installation and testing of the database with duplicator

If everything looks good, then click on the " Next » to continue.

Duplicator will import your WordPress database. After that, it will ask you to check the new website information that it automatically detected.

installation-website-local-duplicatorClick on the button Next to continue.

Duplicator will complete the setup and show you a button to connect to your local website. You will use the same WordPress username and password that you use on your live website.

end-installation-website-local-duplicator

That's it, you have successfully moved your online website to a local server.

Method 2. Manually move an online WordPress website to a local server

In case the plugin does not work for you then you can always manually move your live website to a local server. The first thing you would need is to back up your website manually from your WordPress hosting account.

Step 1. Export your website's WordPress database online

To export the WordPress database from your online WordPress website, you need to log into your cPanel dashboard and click on phpMyAdmin.

how to export WordPress database to cPanel

Inside phpMyAdmin you need to select the database you want to export and then click on the tab Export up.

how to export WordPress database in phpmyadmin

phpMyAdmin will ask you to choose quick or custom export method. We recommend that you use the custom method and choose zip as a compression method.

Sometimes WordPress plugins can create their own tables inside your WordPress database. If you no longer use this kind of plugins, the custom method allows you to exclude these tables.

Leave the rest of the options as they are and click the Go button to download your database backup in zip format.

how to export WordPress database to phpmyadmin and compress

PhpMyAdmin will download your database file. For more details, see our tutorial on manual backup of your WordPress database.

Step 2. Upload all your WordPress files

The next step is to upload your WordPress files. To do this, you need to log into your WordPress website at using an FTP client.

Once logged in, select all of your WordPress files and download them to your computer.

Also discover our guide on How to use FTP on Windows 10

Step 3. Import your WordPress files and database to a local server

After uploading your WordPress files, you need to create a folder on your local server where you want to create the local website.

If you are using XAMPP, you want to create a folder inside the C:xampphtdocs folder for your local website. MAMP users should create a folder in /Applications/MAMP/htdocs/.

After that, just copy and paste your WordPress files into the new folder.

Then you need to import your WordPress database. Just open the phpMyAdmin on your local server by visiting the following URL:

http://localhost/phpmyadmin/

As you have already created the database previously, you must now select it, by clicking on the tab Import.

how to import the database into phpMyAdmin

Click on the button 'Choose File'to select and download the database file you downloaded in step one. After that, click on the button " Execute " at the bottom of the page.

PhpMyAdmin will unzip and import your WordPress database.

Now that your database is all set up, you need to update the URLs inside your WordPress database.

To do this, run an SQL query in phpMyAdmin. Make sure you have selected your local website database, then click SQL.

In the phpMyAdmin SQL screen copy and paste this code, be sure to replace example.com with the URL of your live website and http: // localhost / monsitelocal with the URL of your website's local server .

UPDATE wp_options SET option_value = replace (option_value, 'https://www.example.com', 'http: // localhost / monsitelocal') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET post_content = replace (post_content, 'https://www.example.com', 'http: // localhost / monsitelocal'); UPDATE wp_postmeta SET meta_value = replace (meta_value, 'https: //www.example.com','hhttp: // localhost / monsitelocal');

This request will overwrite your live website URL refences from the database and replace it with the localhost URL.

Step 4. Update the wp-config.php file

The last step is to update the wp-config.php file from your local website. This file contains WordPress settings, including how to connect to your WordPress database.

You just need to go to the folder where you installed WordPress on your local server, then open the wp-config.php file in a text editor like Notepad.

Replace the database name with the one you created in phpMyAdmin on your localhost.

After that, replace the database username with your local MySQL username, usually it is root. If you have set a password for the user root on your localhost, enter this password. Otherwise, leave it blank 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');

You can now visit your local website in a browser window by entering the URL like this:

http://localhost/monsitelocal/

Replace 'monsitelocal' with the name of the folder where you copied your WordPress files.

That's it, your online WordPress website is now copied to your local server.

Discover also some premium WordPress plugins  

You can use other WordPress plugins to give a modern appearance and to optimize the handling of your blog or website.

We offer you here some premium WordPress plugins that will help you do that.

1. Visual Restaurant Reservation

Create the system online booking of your restaurant or cafe website, thanks to this excellent WordPress Plugin premium. With the latter, you will have the possibility to create tables and seats by yourself on the grid that this plugin offers and let your customers reserve the free ones, this is the main feature of this plugin and which sets it apart from other plugins in this list.Visual restaurant booking

Using Drag & Drop, you can drag different types of tables onto your restaurant's grid and calculate the maximum number of seats for each table as well as the number of tables. Visitors to your restaurant will be able to choose the shape of the table they prefer and the location of the latter in relation to the other tables in the grid.

here for you 5 WordPress plugins to optimize category descriptions and labels

The customers of your restaurant will be delighted to make this choice directly on the internet instead of traveling. With this plugin they will be able to get an idea of ​​what will await them today.

Among other features, it offers: Drag and Drop support, 3 types of reservation system, a fairly intuitive handling, complete customization of its layout, and much more.

Download | Demo | Web hosting

2. Quick Edit Pro for WordPress

Ce WordPress Plugin was developed to make your blogging and editing your content easier. quick-edit-pro-for-wordpress

In particular, it allows you to modify: your featured images, your article / page extracts, your publication formats, support for shortcodes and others.

Quick Edit Pro allows you to do all of this without leaving the comfort of the main screen of your posts / pages.

Download | Demo | Web hosting

3. WooCommerce Multisite Duplicator

You have just opened your online store and you want to create another one whose configuration will be almost identical, at the same time you want to manage these two online stores in one place, then this WooCommerce plugin premium of WordPress will help you create a multi-site network that is easy to administer and manage.

Woocommerce multisite duplicator

You will have the possibility to clone your old website and after that you will just have to create new products. the WordPress Plugin WooCommerce Multisite Duplicate therefore helps you to duplicate your products in your multisite network.

Enrich your exploration by discovering our article on: Page Builder: 5 WordPress plugins to create your pages

You can duplicate one or all websites. You can even specify what you want to copy or not.

Download | Demo | Web hosting

Recommended Resources

Find out about other recommended resources to help you build and manage your website.

Conclusion

Here ! That's it for this tutorial. We hope this article has helped you learn how to easily move an online WordPress website to a local server. You can also see our guide on When and how to install WordPress in a subdirectory.

However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation.

Do not hesitate to share with your friends on your favorite social networks. And if you have any suggestions or remarks, leave them in our section Comments.

...