How to make a WordPress site live from a local developed site
The topic of how to make a WordPress site live has been discussed on many forums and plenty of tutorials are already available. The reason why I am once again covering this topic is because even though there are plenty of tutorials available, these assume that the reader has a certain degree of knowledge. In the tutorial of how to make a WordPress site live, I will be starting at the absolute beginning and will be covering every single step of the process.
Technology that will be used:
Step 1: Copying your files
OK so you have developed your WordPress site on your local host, no doubt using an Apache server, PHP and MySQL (or preset up with WAMP or MAMP). Now you you have to take your WordPress site from your development server to your live site. Follow these steps and it will be a breeze.
To make your WordPress site live you will need to have registered a domain and also have an active hosting plan for your domain. Once the domain is live you have access to the back-end either through a FTP client or admin back-end, you can start uploading your files.
Using an FTP client like FileZilla:
1. Open the FTP client and connect to the site via FTP, for this you will need the Host address, Username and Password (note that you can also specify the Port, although this is not always required).
This a the details that you will need to specify to connect to your FTP client. If you are unsure where to get these, you can always connect your web-host, who would gladly provide it to you.
Once you are connected to your site via FTP you will need to transfer ALL your existing WordPress files to your web domain.
FileZilla makes the process of transferring your files a breeze as you can just drag and drop all your files from your development site to your web domain.
As you can see from the picture above, this is the typical file structure of a WordPress site, you should ensure that you copy all of these files.
Import things to note:
- You should not copy your site folder but rather the content to your site, for example, if your site is http://localhost/mysite/ do not copy the /mysite/ folder but the contents of the /mysite/ folder.
- Depending your host, you may have to copy your files to the folder to the /public_html/ folder, in other cases you can copy the files directly to your root folder, once logged in via FTP, but when you run into something like the screenshot below be sure to copy the files to your /public_html/ folder.
Once all the files are completely transferred (you can check the status in the bottom left corner of the FTP client), you can test whether your site has been successfully uploaded by navigating to the site, you will then get the following error:
Error establishing a database connection
This may seem discouraging but it only means that you are on the right track.
Step 2: Exporting your Existing Database
You will need to export your existing mySQL database so that you can import it to your new live database.
Firstly you will need to access your local phpMyAdmin, through the following address:
Once you have accessed you local phpMyAdmin page, you can find your database on the left side of the page, where all your local databases will be listed.
Click the database which you would like to export and you will be navigated to the database structure.
Do not worry about all the data, which might be confusing, all you need is the export tab, which is situated above the database tables as shown below:
You will now navigate to the Export settings page. Most settings can be ignored but always check that the “Save as file” tab is checked and I prefer to leave my compression on none because some web hosts do not allow for compressed database uploads. In some cases it will be required to compress the database, if the size is too large, then you should check with you host to upload the compressed database.
Notice that I left the file name template on the default as this will export your database as “youdatabse.sql”.
Click Go and a “Save file” dialogue should pop-up, store your database in a safe location as we will need it in step four.
Step 3: Setting up your Database
This is the part with what many people struggle but don’t worry, if you follow this step by step instructions, you will have your WordPress site live in no time.
For this tutorial, we will be using the standard cPanel backend which is very common among web hosts. If your web host does not use cPanel, do not despair, you can follow the same instructions and apply it to their technology and it should work perfectly.
Firstly you will need to login into your cPanel, these details can be acquired from your web-host and will just be a username and password.
Once you have logged in you will need to search for the following link, in order to create your new database.
Once you click here you will be taken to where you can create your database. The first step will be to create the database.
This is very simple, all you will need to do is create enter your database name and click create database.
Once you click Create database, you should land on a screen indicating success, after this go back to where you created your database as you will now need to create a user to assign a user to your database.
One the same screen where you created your database, you can create your user, as shown below:
Be sure to keep the username and password at hand because you need will need that for your wp-config.php file.
Once the user has been created you need to assign your user to the database.
We are still on the same page as where we created our user in the first place. Now assign your user by selecting the username and assigning it to your database as shown below:
After you click add you will need to assign privileges to your user.
I normally give the user all the privileges, so you can just click select “ALL PRIVILAGES”.
You should now get a success screen, you can go back and then go back to your cPanel homepage where you can look for and click the phpMyAdmin link.
Click the icon to navigate to your to phpMyAdmin page.
Step 4: Import your database and update your database details
Now that you are on your live phpMyAdmin page you will need to navigate to your newly created database on the left hand side of the page.
You will now notice that there are no tables under the page tabs.
You can click on the import tab, above where your tables should be.
You should now navigate to your exported database and select it.
You can ignore the other setting and click the Go button to import your database.
You should now get the following success message:
Import has been successfully finished, 44 queries executed. (yourdbname.sql)
The queries executed will vary according to your plugins, theme, etc… So do not stress if yours is not 44.
Well done, you have now successfully imported your database. You will now need to run three SQL queries to update your data from the localhost to the live site.
Firstly click on the “Queries” tab next to the Export tab above your tables.
This will take you to your queries page.
The queries that you need to run are the following three, which I will explain below:
* UPDATE wp_options SET option_value = replace(option_value, ‘localhost/yoursite’, ‘www.yoursite.co.za’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
* UPDATE wp_posts SET guid = replace(guid, ‘localhost/yoursite’, ‘www.yoursite.co.za’);
* UPDATE wp_posts SET post_content = replace(post_content, ‘localhost/yoursite’, ‘www.yoursite.co.za’);
The layout of the queries are as follows:
UPDATE – Tells SQL to update the data in the database.
wp_options – This is your options table with the wp_ prefix, you will need to change this, if you specified a different prefix when you created your site.
wp_posts – This is your posts data table, the queries will update both the guid and post_content.
option_value – Tells SQL which value you would like to replace, in this case it is, (option_value, ‘localhost/yoursite’, ‘www.yoursite.co.za’)
WHERE – Specifies where the update should be applied which is not applicable for Queries 2 and 3.
To update your wordpress table you will need to run each query separately but entering the query into the box as shown below:
You can use the code provided below but be sure to change the values to your site for example:
UPDATE wp_options SET option_value = replace(option_value, 'localhost/howlmedia', 'www.howlmedia.co.za/') WHERE option_name = 'home' OR option_name = 'siteurl';
After each query, you should get a success message and if you do not, you should check that your query is correct.
Below are the queries that you can copy and adjust:
UPDATE wp_options SET option_value = replace(option_value, 'localhost/yoursite', 'www.yoursite.co.za') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'localhost/yoursite', 'www.yoursite.co.za');
UPDATE wp_posts SET post_content = replace(post_content, 'localhost/yoursite', 'www.yoursite.co.za');
Once all the queries have been successfully executed, you can close the phpmyAdmin page and you are two steps away from a live WordPress website.
Step 4: Changing your wp-config.php file
You will now need to go back your FTP client app and adjust your wp-config.php file.
In the directory which you uploaded your WordPress files, you will notice that there is a wp-config.php file. You will need to edit this file.
With Filezilla, this can be achieved by right clicking the wp-config.php file and selecting “Edit/View”, this will open your wp-config.php file.
Please note that you should not change anything here except the following:
Here you should enter the name of your database which you created in step 3.
Here you should enter the username of the user you created and assigned to your database in step 3.
Here you should enter the password of the user you created and assigned to your database in step 3.
Here you should enter the database host, if your database is hosted on your server, this will normally be localhost but in some cases the database is hosted somewhere else, if this is the case, contact your web host to get the details.
These are the only details you need to change, I would advice not messing around with the others.
So once this is done, your file should like this:
I am using Dreamweaver but any standard text editor will suffice and also take not to erase an apostrophe.
Once you are complete, you can save the file and reload it to your web server.
Congrats, your site is now live and working!
Try it for yourself!
Step 5: Checking your site
The final steps you need to take is to go through the site and check that all links, images, downloads, etc. are working.
What happens sometimes is that you might have hard coded some links to your local host, you will need to comb through your entire site to check that everything is pointing to the right links.
A nifty tool for this is the W3C Link Checker, this will comb through your site for you and tell you where links are broken.
So that is all their is to it, as soon as you do this a couple of times, it will be a breeze.
If something is not working or you haven any questions contact us and we will see where we can help.
Also if there are any improvements on how to make WordPress site live please leave a comment and I will gladly edit this post.