Upload WordPress Website
- Manual Method: How to move WordPress site from localhost to live Server
To move your WordPress site manually, you will first export it via phpMyAdmin.
Step 1: Export Local WordPress Database
For exporting your database, simply navigate to http://localhost/phpmyadmin/ and select your WordPress database. Next, click Export button from the top menu bar.
You will find two options here – Quick and Custom. Custom will give you more options to export your database.
If you are choosing Custom, make sure that all the tables get selected. Choose the zipped form of compression for the output file. The zipped compression is mainly used for large database files.
Under Format-specific options, select structure, and data. Also, check the following boxes:
- Add DROP TABLE / VIEW / PROCEDURE / FUNCTION statement
- IF NOT EXISTS
- AUTO_INCREMENT
- Enclose table and column names with backquotes
Once done, click Go button to download the database file.
Step 2: Upload WordPress Files to Live Site
To move your WordPress files, open your FTP client. For demonstration purpose, we are using FileZilla FTP client here. First, connect to your web hosting account and browse the root directory of your live server. Then, Upload all the files in the right destination directory. For example, if you want to host the site on mysite.com, then upload all files in public_html directory. You will get an inbuilt File Transfer feature on your CPanel if you are using a good Web Hosting like RAYSCOWEB
Step 3: Create New Database on Live Site
Your WordPress files will take a while to upload, meanwhile import the database saved to your hard drive in the first step. Hosting providers offer different ways to do so. Some do it through phpMyAdmin & some via cPanel. The cPanel is more popular so we are creating a database via cPanel here.
First of all, log in to your cPanel dashboard. Click the MySQL Databases icon in the databases section. Top Hosting providers i.e. Rayscoweb generally provide a direct link to the CPanel login in the first signup email, otherwise you can also find it from your hosting admin.
From the next screen, you will create a database by specifying its name.
After creating a database, navigate to the MySQL Users section. Here, create or add an existing user to the database.
cPanel will take you to set MySQL privileges for that user. Now, grant all privileges to the user by checking every box. Then, click Make Changes button.
Step 4: Import Local Database on Live Site
Go to your cPanel dashboard to import your WordPress database. Navigate to database section and select phpMyAdmin. Now, you can see your newly created database in phpMyAdmin. Go to Import page by clicking the Import Tab on the top bar menu. Next, click on Browse button to choose the database file created in step 1.
Then, press Go to import your WordPress database.
Step 5: Redirect the Site URLs
Now, you have to replace all the links in the database contained inside are still pointing to the old site location. In phpMyAdmin, look for the wp_options table in your database. Click Browse button or the link in the sidebar to open the page with a list of fields within the wp_options table. Under the options_name file, you need to look for siteURL. Click Edit option that will open an edit field window.
In the input box for option_value, you can see the URL of your local install like http://localhost/test. Replace it with your new site URL in this field.
Step 6: Set Up Your Live Site
Once you import the database, it’s time to configure wp-config.php. Connect to your website using an FTP client, find wp-config.php file and right click to View/Edit. Look for the information:
define(‘DB_NAME’, ‘your_database_name’);
define(‘DB_USER’, ‘your_database_user’);
define(‘DB_PASSWORD’, ‘your_database_password’);
define(‘DB_HOST’, ‘localhost’);
Provide the database name, user, and password you created in the earlier step. After that, save the wp-config.php file and upload it back to your server. Your website should be live now so you can log in. Move to Settings » General and without changing anything, Click Save Changes button. It will ensure that the site URL is corrected wherever needed.
Go to Settings → Permalinks, choose your preferred URL structure and save it to ensure all post links are working well.
Step 7: Fix Images and Broken Links
Whenever you move from local server to a live site, it is obvious to get some broken links and missing images. You can either use the SQL queries or use the Velvet Blues WordPress plugin to fix these.
If you choose SQL, go to phpMyAdmin. Click on your database and press SQL from the top menu. Write this query:
UPDATE wp_posts SET post_content = REPLACE(post_content, ‘localhost/test/’, ‘www.mylivesite.com/’);
Replace the local site and live site URLs with your own.
That is it !! You have successfully migrated your site to the live server manually.