Migrate WordPress Website in just 3 easy steps from localhost server to live server on Godaddy, Hostinger, Namecheap and many others server company.
Note: After migrating your website to a live server you may face an error like this “Internal Server Error 500” due to changes in Htaccess file. Don’t worry I have an article regarding for (How to fix internal server error 500).
- Before Migrate WordPress website ready and running on the local server (WAMP)
- Hosting Account with cPanel (GoDaddy, HostGator)
- Code Editor with “Find/Replace” Functionality (Notepad++)
- File Compressor that allows compression to ZIP (WinRAR)
These are the things you need to follow along with this article.
- Database Setup
Let’s go through the first setup is the Database set when the localhost we will export the current Database into an SQL file we will then modify this SQL file. On the server even create new Database, create a new user add the user to the Database and import that previously exported SQL file into newly created Database.
Second step is the configuration of the WP config file you will simply update the file as per the newly created database.
And the third and the final step is uploading the WordPress files to do that we compress the WordPress files to a zip folder upload the zip folder to the server extract the files from the zip folder and finally delete the zip folder.
Let’s start migrating the website…
(Migrate WordPress Website) Database Setup – Localhost
The first step export the site database in PhpMyAdmin of the localhost server to do so.
Log in to PhpMyAdmin and select the Site Database, click on the Export Tab, select Custom as your export method and under the output section give the file a desired name. Scroll down to an end and hit GO and save the file to the local machine.
The second step is to modify the file path in the exported SQL Database file to do so.
Open the exported database SQL file with a Code Editor Notepad++, Hit Ctrl + F to open the find dialog box and click on the replace tab, in the input box enter the URL of the website on the local machine.
In the replacement box enter the URL the domain name to which the website is currently being transport to.
(Double check the URLs and click on the Replace all button) Once done save it and close the SQL file.
(Migrate WordPress Website) Database Setup – Server
Now we need to setup database on the server.
login to cPanel off your hosting account and the first step is to create a database. Go to MySQL database, give the database a name and click on Create Database button, once done click on Go back button.
Next step is to create a User, scroll down to the add new users section enter desire username & password.
Click on the Create User button, once you see the user successfully created message click on the Go Back button.
The Third Step is to add the User to database scroll down on same page to the Add User to Database section select the Create User and the Database from the drop-down list and click on add button.
On the manage user privileges screen check the All Privileges box, scroll down and click on the Make Changes button. Once you see the success message click on the Go Back button.
Final step is to upload the SQL file to the created Database on the hosting server to do so.
Go to Phpmyadmin in the cPanel select the Created Database and click on the Import Tab, click on the Browse button and select the SQL Database file previously save on the local machine, hit Go and wait for the import has been successfully finished message.
Once its uploaded we done with the database setup.
(Migrate WordPress Website) WP-config File Update
Now we need to update our wp-config file to match with the database we created on the server to do so.
First go to the Site Folder from the local machine and locate the wp-config file, right click on the File and open it with the Code Editor (Notepad++).
First step is to save the current information on the file as you may need it later to restore the website in the localhost.
Next replace the Database Name with the name of the Database that you created on the server, in the same way replace the database Username and the database Password. You can now save and close this file.
(Migrate WordPress Website) WP File Upload
Now the last thing is to do is upload the WordPress file to the server, let’s begin with compressing the file to do so.
Open WordPress website folder on your local machine select all the Files by hitting Ctrl + A on your keyboard, right click on one of the Selected Files. And click on the Add to Archive option from the drop down list.
Give the file a name selects ZIP as the archive format and click Ok, this will create a single ZIP folder containing all the WordPress files.
Now let’s upload the zip folder to the server, login to the Main Page of the cPanel and click on the File Manager tab at the top. If you want the site to be transferred directly to your main domain, you can upload the files right here in the Public directory.
However, I have created a Sub Domain for this Demo. Go inside the Demo Folder and upload the Files there, click on the Upload button.
Click on the Browse button and select the previously created ZIP file from the file folder in the local machine. After upload completed.
Right click on the uploaded Zip Files and select the Extract option, once you see that the files have been extracted. Right click on the ZIP folder and select to Delete the zip folder.
That’s it our website should be live on the server now (Check it)
Don’t forget to share with others if you like this article.
Thanks For Reading This Article.
Checkout More Interesting Articles On: Bloggsters