For the steady development of a website, ideally one should build it up locally before making it live. Once, the website was built as per the satisfaction of the owner in terms of overall design and content they can consider it ready to be shared to the world.
For instance, one can migrate WordPress from Localhost to live server by following different methods. However, to initiate these methods, the owners should ensure that they can access their running WordPress or WP site on a local server or localhost. Next, they require a domain name and web hosting.
They can select among some of the best WordPress hosting companies available. Lastly, they need an FTP program to upload their content to a live site.
There are two methods through which one can shift their WordPress site to a live server. They are
– Using a plugin
Using Plugins to transfer WordPress from Local to live server
This is a convenient method and mostly suggested for beginners in WordPress. One can either use an All-in-one WP migration plugin or a Duplicator.
Using All-in-one WP migration plugin
Following steps will help one to migrate WordPress from Localhost to live server
Step 1- In the first step, the owner of a WP site is required to install and activate the All-in-One WP migration plugin.
Step 2- Once it is activated, an option named ‘All-in-One WP Migration’ will appear in the left pane of the dashboard of WordPress.
By clicking on it, an ‘Export Site’ Window will open up that will enquire about the format in which one would want to export their localhost site to. Once the format is selected it would ask them to download localhost.
Step 3- Next, log into ‘cPanel’, install Wordpress on the destination server and the All-in-One WP migration plugin from the dashboard and activate it. Next, click on the ‘Import’ option under All-in-One WP migration plugin section, visible on the left pane of the WP dashboard
Step 4- Select the database file created earlier. It will further ask the users before importing the localhost file. If the users have already taken up a backup for their site, they can click on ‘Proceed’.
Migrating WP site to a live server using Duplicator plugin
To migrate WordPress from Localhost to live server, the Duplicator Plugin could be used through the following steps
Step 1- The users need to download and install ‘Duplicator-WordPress Migration Plugin and activate it. Next, they need to go to ‘packages’ page under ‘Duplicator’ section and click on the ‘Create New’ button. As they continue, Duplicator will run some tests to ensure that everything is as per order.
After completing this step, they will have to click on the ‘build’ button. Once, the process is completed, download options for “Installer’ and the ‘Archive’ package will open up. On clicking on ‘One-click download’ both the files will be downloaded.
Step 2- They need to visit the ‘cPanel’ dashboard and click on the ‘MySQL Databases’ icon from the ‘Databases’ section.
After inserting the name for the database and clicking on the ‘Create Database’ button, the cPanel will create a new database. From the ‘MySQL Users’ section, they have to provide a name and password for the new user and click on the ‘Create a user’ button.
By clicking on the ‘Add User to database’ section, the new user will be allowed to work on the database. Next, they will have to select the recently created user from the dropdown menu next to the ‘User’ field, select the database, and finally click on the ‘Add’ button.
Step 3- Connect the live site using an FTP client and ensure that the root directory of the website is empty. Now the users can upload the archive and installer files from Duplicator to the emptied root directory.
Step 4- This final step will help to migrate WordPress from Localhost to live server. Once the migration files are uploaded, the users will have to visit ‘http://domainname/installer.php’.
This will help in launching the Duplicator migration wizard. The installer will scan the archive file and run a validation test. As they go on clicking the ‘Next’ button to proceed, they should check the terms and conditions as well.
In the next screen, it will ask them to enter the WP database information, where they have to provide information about the database created in the earlier steps. On clicking the ‘next’ button Duplicator will import the backup of the WP database from the archive to the new database.
When it will ask to update the URL or path, the users will not have to change anything as it automatically detects that information. Next, the Duplicator will finish the migration and a screen showing a successful result will open up.
Transfer WordPress to live site manually
This method will help the users to migrate WordPress from Localhost to live server manually.
Step 1- The users will have to visit http://localhost/phpmyadmin/ and select their WP database. Next, they have to click on the ‘Export’ button from the top menu bar. It will provide two options – custom and quick. After choosing any of this two, they have to click on ‘go’ to download the database.
Step 2 – The users are required to open their FTP client and connect to their web hosting account. Then they need to upload files in the right directory. Next, they need to select the local WP files and upload them to the live servers.
Step 3 – The users are needed to log in to cPanel and click on ‘MySQL Databases’ icon from the ‘Databases’ section.
Next, they have to provide a name for the database and by clicking on ‘Create Database’ button, the database would be created. Next, they can either create or add an existing user to the database from the ‘MySQL Users’ section.
Step 4 – Visit the cPanel dashboard and click on ‘phpMyAdmin’. Then click on ‘Import’ in the top menu. Next, on the import page, click on ‘Choose File’ button and select the database created earlier. Lastly, press the ‘go’ button.
Step 5 – In ‘phpMyAdmin’,check the wp_options table in the database. Next, click on ‘Browse’ button next to it or the link visible in the sidebar to open the page with the field list within the wp_options table. Here, they need to look for ‘SiteURL’.
On clicking the ‘Edit’ option, a window will open up. In the input box for ‘option_value’, the URL of the local install such as ‘http://localhost/test’ will be seen. Replace this with the new site URL. Next, by clicking on the ‘Go’ button, the field will be saved. The same step is to be repeated for the option name ‘home’.
Update the home URL the same as the Site URL.
Step 6 – Connect the website using an FTP client and edit ‘wp-config.php’ file. The name of the database, along with username and password created previously is to be provided.
Next, the file should be saved and upload it to the server. The website should be live after this step. The users are then needed to log in to the WP admin panel and go to ‘Setting’ and then ‘General’. Next, click on ‘save changes’ button to ensure that the site URL is updated everywhere.
Next click on ‘settings’ and ‘Permalink’, followed by ‘Save changes’, to ensure that all the post links are in working condition.
Step 7- Lastly, either use a SQL query or the ‘Velvet Blues’ WP plugin to fix the broken links and missing images.
All these above-mentioned methods will help in successfully migrating the WordPress site from the local server to the live server.