Contents
If you’ve already created a Wordpress blog on your computer using WampServer, how then do you transfer it from localhost to the internet without losing the design, installed plugins, posts and everything? There are four main things you need to do to accomplish this:
1. Upload the files from localhost to cPanel file manager/FTP
2. Import the database from the local PhpMyAdmin to the one on your server
3. Editing wp-config.php file
4. Changing the site’s URL from phpMyAdmin
1. Uploading the files to cPanel
– You should go to the location you installed WordPress to on your computer. If you used WampServer and followed the guide I previously wrote, this should be in C:\wamp\www\wordpress
– Compress all the files located here to a zip file.
– Log in to cPanel > file manager or FTP, and upload the zip archive to public_html or the root directory
– Extract the files to this location.
Now you’re done with the first step, let’s proceed.
2. Exporting and importing the database
All your settings, posts, created pages and the most important data that make your WordPress blog function properly are in the database. You must export this from localhost and import it to the database on your server through phpMyAdmin.
– Launch WampServer and go to http://localhost
– Select phpMyAdmin
– Click on your WordPress database on the left
– Now select Export and click Go
– You should see a download dialogue. Save the .sql file.
– Now log in to cPanel and go to phpMyAdmin
– Click on Databases and create a new database. Name it whatever you like but be sure it’s something you can remember. If this function is unavailable, to to cPanel > mySQL databases to create a new database.
– After creating the database, select it from the left (in phpMyAdmin) and click the Import tab. Locate and upload the.sql file you downloaded earlier, remember?
– Now you’ve successfully imported the database, lets move on to the next step.
3. Editing wp-config.php file
This file is what connects your wordpress blog to the database and it needs to be edited.
– Go to cPanel file manager/FTP and locate the directory in which you installed WordPress. Locate wp-config.php and open it using cPanel editor.
– Scroll down a bit till you see something that looks like this:
define(‘DB_NAME’, ‘wordpress‘);/** MySQL database username */
define(‘DB_USER’, ‘root‘);/** MySQL database password */
define(‘DB_PASSWORD’, ‘password‘);/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);
As you can see, you’re only changing the words in red.
wordpress = The nameof the database you created on your cPanel. Normally, you should write it here in this format: username_databasename. Username is your MySQL username which is the same thing as your cPanel username in most cases. For example, doncaprio_wordpress2.
root = your MySQL username. In most cases, this is the same as your cPanel username but if it’s different, you should contact your host.
password = your MySQL password. Again, this is often the same as your cPanel password. Contact your web host if it’s different.
4. Changing the site’s URL from phpMyAdmin
– Go to phpMyAdmin in cPanel, select your database, then click wp_options table
– Locate the option name labelled site_url
– Edit this line and replace http://localhost/wordpress with your real domain name. Ex. https://www.doncaprio.com
– Now click on GO to save your changes.
Last Step…
– Check http://your-domain.com/wp-admin. Normally, this should display the admin login page.
– If there’s an error message about database connection, you should go back to Step 3. Your MySQl database name, username or password is wrong and you must contact your host if this happens.
– Log in with the username and password you used to log in on localhost.
– Go to Settings > General. Update your URL if you still have http://localhost/wordpress there.
That’s all! You may now check your blog to see it appear just the way it appeared on WampServer, including all the posts and everything. Still having issues with it? Drop your comment maybe I can be of help. A friend who runs a Calgary based IT services was able to do this without any trouble.