Most web developers follow the way of "first local, then on the server" for their website's early development or setup stages in order to gain either speed or freedom in installing pluging and extensions due to servers' permissions for files and folders.
A small problem comes around when you need to move your site from your local environment ( commonly XAMPP ) to your webserver so your website can go "live". This article will let you know the steps you need to follow when it comes to Wordpress and moving if from local to yuor server.
Before we start, you will need to :1. have the url, username and password of your hosting environment's management panel ( cPanel or Plesk e.t.c. ) and log into it.
2. in your hosting panel, you need to add FTP access to your site, you will need to jot down the IP or domain name ( depending on DNS ), a username and a password
3. you will need to go into your hosting's database management via your management panel, create a new database ( for wordpress this is mysql ), name it, add a username and a password and jot all of those down, we will need them soon.
4. go to your hosting panel's mail settings and add a mail account for your site, i.e. firstname.lastname@example.org and jot down the address and its password, along with its POP and SMTP mail server addresses.
Now we can start.
Step 1 - Zip your files and upload the zipped file, then de-compress on-serverYou will see that if you select all the files of your website ( thus the contents of c:/xampp/htdocs/mysite/ ) to an archive, the size will decrease significantly. In such manner, we are to zip the files in our local environment, upload the file to the server and then de-compress or un-zip those over there, mainly to gain bandwidth and time. Its not that wise to wait for 100 Megabytes to be uploaded ( containing a lot of very small files which tend to stall the transfer ) when we can upload for instance 60 Megabytes of just one file. Of course, there may be a chance that our zip file is uploaded badly and we may need to re-upload, but that is rare.
To upload our files to the server, we will need an FTP application. Yes, there is an option to transfer our file via the browser's upload function through our hosting panel ( i.e. cPanel or Plesk ) but its better to do this via the FTP application so we will not have to face timeouts and small network hickups that can break our transfer. The most common application for FTP ( we will need to have FTP access credentials ) is FileZilla. One thing to note about filezilla is to never store the passwords as this can cause us very very serious problems...
Here is how to disable password saving in FileZilla ( its called Kiosk Mode ) , open Filezilla and go to Edit->Settings then follow the image below :
Ok, after you have the FTP credentials we mentioned earlier, you will need to fill them in at the top site of filezilla as you can see below :
Once you click "Quickconnect" you will see the window blow this bar, to start loading files and folders. You will need to transfer your zipped file onto your webserver, preferably in the htdocs or www or root folder and wait until this is uploaded.
Once the file is uploaded, you will need to visit your hosting panel's file manager and go to that same folder, select the file that you've just finished uploading and de-compress it.
Step 2 - Upload the database via phpmyadminWordpress is accompanied by a database which is implemented in mysql. You will need to go to your http://localhost/phpmyadmin and in the list of your databases to your left, select the database that refers to your site and click "Export" as you can see in the image below :
Now, you need to visit the same tool up onto your web hosting panel, there is a phpMyAdmin there too, your hosting provider has given you the address, or you can visit phpMyAdmin on your server via going in to visit the web panel for your database, the one you created online just before we started. When you visit the panel, you will need to do the reverse step, upload the file you got from the export.
In your webserver's phpMyAdmin, you will select the database from the list to your right and then ( careful you must select your database first ) select "Import" then you will select the file ( .sql file ) you got before and upload. Then the database and the data will be restored.
Step 3 - Update your configuration fileYou will need to open up your webserver's file manager and go to your site's root folder, then open and edit the file named "wp_config.php" which contains the settings for your site and how it connects to your database. You will need to change the settings here to match your webserver's settings, those you've set up just before we started.
Step 4 - Update database tables and settingsWhen starting with wordpress locally, all the local-specific settings are bound into the database. For instance, your site's homepage address will be http://localhost/mysite which is ok for local but will never work on your webserver. We need to change such settings via the webserver's phpMyAdmin tool and here is how.
UPDATE : before running manual commands, you can try and download a tool titled "Database Search and Replace" from interconnectit here, unzip it in your wordpress root and then after you update your wp-config file with the information of the new live database, run the url of the replace tool and it will replace everything in your database for you. Its pretty slick and working great. There are two versions, one based on AJAX and one based on simple PHP, if the first does not work for you, you can try the basic one.