Tips & tricks on moving your WordPress site

Are you happy with your success on setting up the WordPress? Are you ready to start creating your website? Usually the beginning is very exciting, but afterward, you rethink the content, as well as the structure over and over again, while it turns into experiments. You don’t want them to be visible yet for your potential clients. What’s the solution? And how to move your site without losing everything you have created?

The solution in one sentence is to make your computer work as a server or localhost. You will have no limitations to develop your site, but it won’t be visible to others. We will guide you through the process of doing that in this article. So by reading this, you will find out:

  • How to start a web page on the localhost and then move it to live version;
  • How to make changes on localhost and afterward update the site that is already running;
  • How to move a site to a new domain without losing SEO data.

Preparation work installing all programs

The first thing to do is to download the latest version of the WordPress from the official site here by pressing ‘Download WordPress’ on the upper corner of the site.

WordPress.org - official WordPress website

Store the zip file on your computer. The other program that you should get is WAMP or MAMP. It is a web development environment that allows you to create web applications, as well as manage databases. Go to the website and get the latest version.

The installation will begin and you will be guided through simple questions. We suggest you press ‘Next’ on every window and leave all settings as they are. For example, leave the destination folder as automatically detected, choose a browser and the text editor.

One more nuance. The program will ask your permission to create an exception in Firewall for ‘Apache HTTP Server’. Allow access to the guarantee that the program will work correctly.

It is easy to check whether everything is set up correctly. Just run the program.

All set, let’s go!

The next step is to create a database where to put WordPress files. Open the program and choose ‘phpMyAdmin’.

PhpMyAdmin WordPress Database

The new tab will open in the browser that you have chosen as a default during the installation process. You will have to type the username and password. Just type ‘root’ as a username and leave the password row blank. In the window that is going to open, choose the ‘Database’ tab on the upper menu:

PhpMyAdmin Databases

Afterward, you should choose the ‘Database name’ under the ‘Create database’. Name it with the reference to the name of your site, as well as to WordPress by adding ‘wp’, for example. Push ‘create’ button and leave this place.

Find the folder on your computer where you have the ‘wamp64’ folder stored. If you haven’t changed anything during the installation process, then it should be on your hard drive. Open it, find the folder ‘www’ and put a zip file there – the one with the whole WordPress package you have downloaded from the official site WordPress.org. Unzip it into this folder and rename it as ‘wordpress’.

Now you have to connect this folder with the database you have created previously. Open the ‘wordpress’ folder and find the ‘wp-config-sample.php’ file here. Make a copy of it and rename it as ‘wp-config.php’. Here’s advice on how to do it and what information you should change – find the information here.

WordPress installation screen

When it is done, open the http://localhost/wordpress/ in your browser and choose the ‘wordpress’ option. Windows with the settings will open. Follow step by step, and the box right beside ‘Search Engine Visibility’ leave blank, because you want to work offline.

From localhost to live

When you have created the website you want and it is ready to be published, you have to make it live and visible to everyone. You will need hosting for that. Read here how to choose the most appropriate one. Also, you will need Filezilla – a free FTP solution that allows the transfer of files between a local computer and the server – find more information here.

There is a built-in export tool in the WordPress dashboard that can be used to move all existing content to another location. You can find it on the ‘Dashboard’ on the left side menu under ‘Tools’. There you should choose what do you want to export. If all the information is new to your site and you have built it from scratch, you should export ‘All content’. The WordPress will create an XML file. Save it on the computer.

Export from WordPress in XML format

Now you have to install WordPress on the server. Before importing all the content, you should install all plugins that you have used on the localhost. In addition, you have to install a plugin that is used for the XML file import. Usually, the option to install it is already provided in the ‘Import’ section.

Import content into WordPress with XML

Run the plugin and upload the file with all your site data downloaded from the localhost.

Browse XML file for WordPress import

Now all your posts, pages, media, and menus should be on the live web page.

Moving the site manually

This way described above is the method how to do the import and export automatically without much effort. There are two other options for making the website run live – use plugins that are also used for the site backup and are described here or do the import and export via ‘phpMyadmin’ manually. We are going to look through the ‘phpMyadmin’ and manual process due to the fact that it is also going to be useful for updating information that you changed on localhost, but would like to add to the live version of the site.

The first thing to do is to access the database through ‘phpMyAdmin’ by writing localhost/myadmin into the browser. When you open the folder ‘WordPress’ or the one with your WordPress site in it from the folder tree on the left side, you will find all the content here. Choose ‘Export’ option from the upper menu. The ‘Quick’ method is selected by default, click ‘Go’. The SQL file will download to computer.

Export tables from database with phpMyAdmin

The biggest inconvenience with this process is that all links for any information in the website are going to include ‘http://localhost’ in their path. This link structure should be modified when files are uploaded to the live site. Otherwise, the content won’t display properly. To correct this, you should open the downloaded SQL file with the ‘Notepad’ or ‘Notepad++’ text editor program and use function ‘Find and replace’. You should find all names containing ‘http://localhost/’ and replace the name ‘localhost’ with live URL, for example, www.mysite.com. When the appropriate replacement is used in all places, save the file and close it.

More advanced users can change permalinks after uploading the database from the localhost on the server. This can only be done after the step explained below when the new database is already on the server. Choose the database and open “SQL” on top of the menu. The empty window where you can put the code will appear.

Run SQL query

The code that you should write is:

UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/', 'www.yourlivesite.com/');

“localhost/test/” is the address where your page was previously stored on the localhost. “www.yourlivesite.com/” is the live link to the website.

The next step is to create a new database on your server where the live site is going to be located. Here is the whole process explained in our previous blog posts. Now you are ready to import the database you have downloaded from the localhost to the server.

WordPress database import with phpMyAdmin

Don’t forget to configure ‘wp-config.php’ file properly. The whole process is explained here. Now you can transfer all the content as explained above.

Afterwards, login to administration panel of your WordPress site. Choose “Settings” -> “General” from the menu on the left side and just click “Save Changes” without changing anything. Next, choose another subsection “Permalinks”, make sure that the right structure with your new domain name has been chosen and hit “Save Changes”. Your site should be up and running. If not, you should carefully study all the steps explained above to understand where you went wrong.

Moving the site without losing SEO data

Another reason why the site could be moved is due to the change of domain. It is a risky procedure due to the fact that SEO data can be lost and you should start all the promotion work from the scratch. So it is important to move the site correctly, while the site ranking might still temporarily be affected. And this procedure described below is just for moving the site from one domain to another, but not for moving it from one server to another.

The first thing to do is to create a full backup – here is the guide how to do it. Then you should activate Duplicator plugin – the one that is also described in our site backup guide. Activate it and create the new duplicate package of the website by pressing “Create new”. At the end of the process, which will take some time, the .zip file is going to be created. Download and store on the computer both the “Package” and the “Installer”.

WordPress Duplicator packages

Access the server using FTP file management system, for example, Filezilla etc. The directory that is intended for the new site should be completely empty. Put both files – the “Package” and the “Installer” – inside the directory. Afterwards, launch the installer by typing http://www.yoursitename.com/installer.php into your browser. Provide all the information needed, check that you have read all warnings and notices and push the button “Run deployment”. Thus, you will have old database themes and plugins on the new domain. Update your URLs while completing the ‘Duplicator’ installation process. Go to the dashboard “Settings” -> “Permalinks” and hit the “Save changes” button.

Turn back to FTP and delete installer.php, installer-data.sql and the installer-log.txt files from the root folder of the new site. Afterwards, open the old site folder on the FTP and find folder ‘wp-includes.php’ or ‘wp-admin.php’. Find the .htaccess file there, open it and paste the following code there:

  1. #Options +FollowSymLinks
  2. RewriteEngine on
  3. RewriteRule ^(.*)$ http://www.newsite.COM/$1 [R=301,L]

Put the address of the new site in the code instead of the existing link. Now the old site should automatically redirect user to the new site when the old domain is written in the browser.

The next step is to inform Google about these changes. You can do this by using Google Webmaster Tool. Log in and find the “Configuration” on the menu on the left-hand side. Open it and press “Change of Address”. Follow all the steps and Google will also be informed about the changes you have made.