Web development has been becoming more interesting as the technology grows. Some of web developers tend to create websites through local servers and later on updating it live. However, how about those who have already turned their website live and would want to transfer it to local server? Yes, there are actually instances that this happens. Currently, WAMP and MAMP are just some of two popularly used applications to create a local server environment. With it, web developers tend to install WordPress to built their own site website locally. However, over a period of time, your live website might have a lot of deviations comparing as the localhost site. From this, you might want to start moving live WordPress website to local server. This happens if you want to test themes, plug-ins, or extensions without affecting the live version of your website.
There are already a lot of plugins available in the worldwide web that can help speedup your backup process. But still, in this particular article, we will walk you through the tips on moving live WordPress website to local server.
Two Methods on How to Move Live WordPress Website to Local Server
If you have already been developing websites for quite a long time, you sure know how creating a localhosted WordPress site is actually not difficult thing to do at all. It will actually only take you a few minutes to create a basic one. However, moving live WordPress website to local server is another thing. You can actually use plugins to speed up the process or you can do it manually. In this certain article, we will present two methods. Here are the tips that you could follow on moving live WordPress website to local server:
Method #1 Plugin Moving Live WordPress Website to Local Server
As mentioned above, there are already a vast number of available plugins that you can use for moving live WordPress website to local server. In this particular page, we will be making use of the Duplicator plugin for your live WordPress website. This certain plugin will allow you to create a duplicate package of your whole WordPress site. Aside from that, you can use it to move your own WordPress website to another new location and make use of it as a backup plugin as well. After activating the certain plugin, a new menu named “Duplicator” will be added.
Method #2 Manually Moving Live WordPress Website to Local Server
In this tutorial, we are assuming that you have already gone through the phase of creating a local WordPress site. If you haven’t yet, you must complete it first before proceeding.
#1 Activating MySQL and Apache
If you have already set-up a local WordPress site, then you need to install Xampp for Windows, activate the Apache and as well as MySQL on your desktop. In simple terms, you will have to set up a local server that you own WordPress installation will be able to sit on.
This only works for those who are using Windows. If you are a Mac user, you will have to follow another tutorial.
#2 Backup Your Website’s WordPress Files
The second would require you to grab your live website’s WordPress files and you have to copy them on your local server.
For your to access your live website, you need to do it through FTP. Once you are already there, you should download all the files that relates to your website. In the root directory, you will find your websites content in “yoursitename“.
If you have doubts and is not sure of what you are doing, you can just find the directory containing folders like “wp-content” and “wp-admin“. Aside from those folders, there are also a lot of files together in that directory like “wp-config.php” and “index.php“.
Once you are done downloading the files, place that certain root directory into the “htdocs” folder. It can be found in a certain location where you have already installed the Xampp (you will be able to find it at “C:/xampp/”). If you are using MAMP and a Mac, you will just have to follow the same instructions but you have to adjust the local directory to suit.
For you to check if all the files have successfully been transferred, then open a browser and try to navigate to “http://localhost/yourfoldername/”. If you do so, you will be able to see a database error such as this:
#3 Exporting Your Website’s Database
When you install WordPress, database the center and it does not have the files that you have just downloaded. So, in this step, you will have to grab the files and then install it locally. But before you proceed, you should know first which particular database you are actually looking for. Fortunately, the data is already within those files that you have already downloaded.
In order for you to do this, you just have to find the root directory of you website’s fresh copy located within your desktop computer, and then proceed to opening up “wp-config.php” in a certain plain text editor. You should try looking for this particular line:
You should see the name of your database in that particular box. And you should take note of it.
If you are done checking, then you now have to login to phpMyAdmin. This is what every great hosting provider offers as one of their features. Here is where you can find the particular feature in a cPanel (most of the hosting providers utilizes this):
If you happen to have not found the particular feature, do contact your web host provider as they should be able to assist you.
Once you are done logging in into phpMyAdmin, you can find the “Export” tab and click on it. On the next screen, you should be able to find a link that says “Custom” export method. From there, you will be lead to a screen where there are a number of database selections to export:
You would only want to export the database that you have checked in the wp-config file, so just click that particular database. You do not have to mind other custom settings, just proceed to clicking the “Go” button at the very bottom of the page. If you do so, the particular database will then be downloaded to your desktop computer.
#4 Importing your Website’s Database to Local Server
In the fourth step, take that very same database and import it to your local server’s phpMyAdmin. For you to be able to login, you just have to open a browser tab and type in in the address bar “http://localhost/“. If you are currently using Xampp, you will be lead to a pop out of main menu. From there, you will see an option for the local server’s phpMyAdmin in the sidebar.
If you are a Mac user and is using MAMP or a program similar, you will still be presented with just a similar screen.
Once you are now logged into the phpMyAdmin, you should select the “Import” tab. From this particular screen, do select the certain database file that you have just exported from the live server. If done, click “Go“.
#5 Setting up the Database for Local Usage
After doing the first four steps, the database of our website will now be imported into your local server’s phpMyAdmin. If the process is completed, do click on the “Databases” tab. Your website’s database will now appear in the list. You will notice a “Check Privileges” next to your database, so you have to click on it.
You will be lead to another page wherein you will have to select the option “Add user“. After doing so, you will be asked to enter a user name, host and password. You will be able to find your user name and as well as password in the same file “wp-config.php” that you have just accessed earlier. In that particular file, you should be looking for the “DB_USER” and as well as “DB_PASSWORD” variables. For the host, you just have to type “localhost“. If done, you do not need to edit anything from the other settings – simply click “Add user“.
Finally if done, you need to edit two of the fields within the WordPress database itself. From there, navigate back in to the “Databases” tab and do click on your certain database name. If you open the “wp_options” table, you will be able to see this list of table:
From this table, you need to edit “siteurl” and the “home“, which you will be able to navigate on the second page. Click on the “Edit” link in the left side of each option_name, and replace he URL contained in the “option_value” with this line: “http://localhost/yourfoldername/“.
Done with steps 1 through 5? That’s it! You have now successfully moved you live website to your local server. If you navigate “http://localhost/yourfoldername/” to your browser’s address bar, you will be able to see that loaded local version of your website. However, do note that if you have used custom permalinks, you will have to change them back to default (WordPress > Settings > Permalinks screen) in order for the internal links on your website to work. Though, you can still change the permalinks back to their default form any time, so you should not worry.