How To Transfer WordPress Site From Localhost To Server?

how to migrate wordpress site from localhost to server

Most of you may have an offline website running on the local host. That localhost may be created by Xampp for windows and MAMP for Mac users. Do you know how to migrate WordPress site from localhost to server? Have you ever thought that you should move your website on a live server so that the whole world can access the information?

In this post, I am going to tell you how to move website from localhost to server. It doesn’t matter whether you are a Windows user or the Mac user. The thing is the localhost has the same features in both.

How To Migrate WordPress Site From Localhost To Server?

There are many things to do for the migration of the website. You all know that the database and the directory files are the things to transfer from the localhost to the live server.

Step 1:- First of all, you have to create a new database using the cPanel of your web hosting account. It’s because you have to import the database on this new database.

move website from localhost to server

Step 2:- Visit your localhost phpMyAdmin by typing “localhost/phpmyadmin.” in the browser. Let me tell you that the phpMyAdmin is the same you see in your cPanel. There is nothing different on the localhost. You have to export the database.

In true words, you have to backup the database of your website from the localhost phpMyAdmin. Download it on your hard drive.

how to migrate wordpress site from localhost to server

Step 3:- Upload that database using the “import” option in the new database you have created in the first step using the phpMyAdmin from the cPanel of your web hosting account.

Step 4:- Now is the time to upload all the files on the live server or we say it the web hosting. You can use your FTP account from the Filezilla. For which, you should know how to connect Filezilla to FTP server.

transfer website

If you don’t want to use Filezilla then you can directly upload the files in the cPanel. Let me remind you that it would be hard to upload directly on the server without using any tool like Filezilla. If the size of your website is smaller then it would be fine otherwise, the upload may get interrupted in between.

Step 5:- To upload the files, copy all the files from the Xampp folder or any software you are using. Just go to the Xampp folder in the drive where you have installed in on your computer.

After that find the WordPress folder or the folder in which you have stored the data of your website. If you can’t find the files then the best way to use the Filezilla. It is because you can find the files easily and the upload would be easy.

In most of the cases, people don’t create any folder, so just open the “htdocs” folder where you can find all the files of your local website. If you find the WordPress folder then open it and copy all the files and folders.

Step 6:- Login to your cPanel and open the “file manager” from the files section. Paste all the files and folders you have copied in the previous step here in the root directory.

Step 7:- Change the URL of the site. It can be done from the database using the phpMyAdmin from your cPanel.

Step 8:- You may be getting the database connection error. It’s because the credentials of the database are not same as on the localhost. To remove that error, you have edit the “wp.config.php” file from the cPanel. You would find the file in all the files you have just copied.

Right click on that file and choose to edit the code. You would find the database name, host name and similar lines. You have to fill those credentials according to the database you have created in the first step. You can’t transfer WordPress site from localhost to server until you fill all the credentials correctly.

Step 9:- Set the SEO friendly permalinks from the WordPress dashboard.

Step 10:- Are you getting the broken image links on your whole website? It is because you haven’t change the path yet. You should change the path by adding two lines of the code in the SQL editor.

Step 11:- Many bloggers forget to set the DNS server. You have to set the DNS server for your domain name. For every web hosting company there is a different DNS server. You can check the server from your web hosting website.

transfer wordpress site from localhost to server

Step 12:- The migration may take 24 hours to show your website online. It’s because the DNS server takes time.

You have successfully migrated your website from the localhost to the live server.

Do You know How To Move Website From Localhost To Server?

I have explained the best possible way to transfer WordPress site from localhost to server. Make sure that you find the right folder where you have stored the data of your website in XAMPP or MAMP. If you copied the wrong files then it won’t be possible to make your site alive.

To move website from localhost to server it’s important to create and import the database of your offline website is the necessary step. Connect the database by filling the credentials in the “wp-config.php” file.

If you still face any problem while following the procedure then you can ask me anything about it. I will try my best to solve your problems.

by Ravi Chahar

A WordPress Professional and the LinkedIn Influencer. A coder by passion and a blogger by choice. WordPress theme development is his forte. He is your WordPress guy who will teach you how to solve WordPress errors, WordPress security issues, design issues and what not.

Get Free Updates Into Your Inbox

Learn Everything Just Like I Did



  1. I struggled for many years for this solution, always faced problems moving from local to the server. Though I figured it out, but this article will be life-saving for those to are still struggling, Best a newbie can get,

    Thanks for sharing!!

    1. Hey Priyam,

      There are many people who are running their website on the localhost just to experiment with them. They should bring their website to an online server so that the world can know about it.
      For newbies, it’s kind of hard to figure out about the migration of the website from the localhost to the server. I hope this article would help them.
      Thanks for your support.
      Have an awesome day.

  2. Hey man,
    I can’t remember the last time I setup WP on my local server before moving to online. It’s always easier to do everything directly online.
    Some few weeks ago, I was contacted by this guy who designed his wp site on his laptop but once he uploaded, everything broke. He missed the url option in the database which I helped him with a solution.

    I think your post is a huge requirement. You are targeting some highly needed but neglected topics here. Keep it up bro

    1. Hey Enstine,

      I agree that we don’t look upon the offline set up of a website after using it online. But still, you know that there are many people experimenting with their website and developing few templates for their websites.
      The URL point is the most important one. These kinds of small points can help the beginners.
      Thanks for your informative input.
      Have a great day.

  3. Hey Ravi,

    These are technical tips that are required for bloggers to know.

    It’s unfortunate some of us don’t know these till now. But it’s good you’re helping us, bro.

    I’ve never delegated my blog to be worked on. All technical fixes are handled solely by me.

    That’s why I find posts like these useful.

    Bookmarked for reference.

    Thanks for sharing, and do have a great week, bro.



    1. Hey Francis,

      Building an offline website may help you to know every aspect of the WordPress. But when you decide to transfer to your online web hosting server then you have to take care of these things.

      I have noticed that the bloggers get confused when they hear about such things. Instead of fretting, they need to learn more.
      Thanks for showing your presence.
      Have a nice day.

    1. Hi Jeannette,

      WordPress is an amazing platform to use. And it’s good that you should know everything about it. Transferring a WordPres site from the localhost to the online server is something newbies should learn.
      Thanks for stopping by.
      Have a nice day.

Leave a Reply

Your email address will not be published. Required fields are marked *