Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Move WordPress From Local Server to Live Site (2 Methods)

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Many WordPress users prefer to work on their websites using a local server on their computer before transferring it to a live hosting server.

It allows you to work on your website privately before making those changes available online.

Eventually, you’ll need to move it to a live server to make it available for online visitors.

In this article, we will show you step-by-step instructions on how to move WordPress from a local server to a live site.

How to move WordPress from local server to live site (2 methods)

Why Move WordPress From a Local Server to a Live Site?

Building your WordPress blog on a local server is a safe way to test changes on your website without affecting visitors.

When you have finished perfecting your website, the next step is to move from your local server to a live site.

Let’s show you two ways to move your site from a local server to a live site.

The first method uses a WordPress migration plugin and is recommended for beginners.

In the second method, we will show you how to manually move WordPress from a local server to a live site.

You can choose the method that works best for you:

Before You Migrate Your WordPress Site

To migrate WordPress from a local server to a live server, you need to have a few things in place.

First, we are assuming that you have a WordPress site running on a local server (also called localhost) on your computer and you have full access to it.

Next, you’ll need to have a domain name and web hosting.

To make your decision easier, we recommend using Bluehost. They are an officially recommended WordPress hosting company, and they are giving WPBeginner users an exclusive discount + free domain and SSL.

Basically, you can get started for as little as $1.99 per month.

If you want a great Bluehost alternative, you can look at Hostinger. They are also offering an exclusive discount to WPBeginner users with a free domain name.

If you can afford to pay a little more, then check out SiteGround. They also have a special deal for WPBeginner readers.

If you need help setting up your website, then follow our step-by-step guide on how to make a website.

Finally, you will need an FTP program and know how to use FTP to upload your local server site to the live site.

Ready? Let’s begin migrating your WordPress site.

Video Tutorial

Subscribe to WPBeginner

If you’d prefer written instructions, then just keep reading.

Method 1: Transfer WordPress From The Local Server to Live Site Using a Migration Plugin (Recommended)

This method is easier and recommended for beginners. We will be using a WordPress migration plugin to move WordPress from localhost to a live site.

Step 1: Install and Set Up the Duplicator Plugin

First, you need to install and activate the Duplicator plugin on your local site. For more details, see our step-by-step guide on how to install a WordPress plugin.

Pro Tip: There is also a pro version of Duplicator that offers secure backups, cloud storage, easy site restore, and more.

Upon activation, you need to go to the Duplicator » Packages page and click on the ‘Create New’ button.

Create new package for migration

This brings you to a screen where you can give your backup a name.

Then, click the ‘Next’ button.

Name backup package

Duplicator will now run some tests to see if everything is in order.

If all items are marked ‘Good’, then click on the ‘Build’ button.

Build package

This process may take a few minutes, depending on the size of your website. You need to leave this tab open until the process is complete.

Once finished, you’ll see download options for ‘Installer’ and ‘Archive’ packages. You need to click on the ‘One-Click Download’ link to download both files to your computer.

Download package files

The ‘Archive’ file is a complete copy of your WordPress site. It includes all WordPress core files as well as your images, uploads, themes, plugins, and a backup of your WordPress database.

The ‘Installer’ file is a script that will automate the entire migration process by unpacking the archive file containing your website.

Step 2: Create a Database for Your Live WordPress Website

Before you can run the installer or upload the WordPress website from localhost to your hosting server, you need to create a MySQL database for your new live website.

If you have already created a MySQL database, then you can skip this step.

To create a database, you need to visit your hosting account’s cPanel dashboard. Then, locate the ‘Databases’ section and click on the ‘MySQL Database Wizard’ icon.

MySQL Database Wizard

On the next screen, there’s a field to create a new database.

Simply provide a name for your database and click on the ‘Create Database’ button.

Name new database

cPanel will now create a new database for you.

After that, you need to enter a username and password for your new user and then click the ‘Create User’ button.

Create new database user

Next, you need to add the user you just created to the database.

First, click the ‘All Privileges’ checkbox.

Check all privileges

Then, scroll down and click the ‘Make Changes’ button to save your changes.

Your database is now ready to be used with your WordPress site. Make sure to note down the database name, username, and password. You’ll need this information in the next step.

Step 3: Upload Files from Local Server to Live WordPress Website

Now, you need to upload the archive and installer files from your local site to your hosting account.

First, connect to your live site using an FTP client. Once connected, make sure that the root directory of your website is completely empty.

Normally, the root directory is the /home/public_html/ folder.

Some WordPress hosting companies automatically install WordPress when you sign up. If you have WordPress files there, then you need to delete them.

After that, you can upload the archive.zip and installer.php files from Duplicator to your empty root directory.

Upload archive and installer files

Step 4: Running the Migration Script

After you have uploaded the migration files, you need to visit the following URL in your browser:

http://example.com/installer.php

Don’t forget to replace ‘example.com’ with your own domain name.

This will launch the Duplicator migration wizard.

The installer will run a few tests and will initialize the script.

Duplicator migration wizard step 1

Under the Setup section, you will be asked to enter your MySQL host, database name, username, and password.

Your host will likely be localhost. After that, you will enter the details of the database you created in the earlier step.

Then, click on the ‘Validate’ button to make sure the details you entered are correct.

Validate settings

After that, click on the ‘Next’ button to continue.

Duplicator will now import your WordPress database backup from the archive into your new database.

It will also update URLs pointing to the local site to your new live site.

You can now click on the ‘Admin Login’ button to enter the WordPress admin area of your live site.

Admin login

Once you log in to your live site, Duplicator will automatically clean up the installation files.

That’s all. You have successfully moved WordPress from the local server to your live site.

Method 2: Manually Transfer WordPress From the Local Server to the Live Site

In this method, we will show you how to manually move WordPress from the local server to your live site. It will be useful if the first method doesn’t work or if you prefer to do it manually.

Step 1: Export Local WordPress Database

The first thing you need to do is export your local WordPress database. We will be using phpMyAdmin to do that.

If you are unfamiliar with it, then you might want to take a look at our guide to WordPress database management using phpMyAdmin.

Simply go to http://localhost/phpmyadmin/ and click on your WordPress database. Next, click on the ‘Export’ button from the top menu bar.

Export from localhost

In the ‘Export method:’ option, you can choose ‘Quick’ or ‘Custom’. Custom will provide you with more options to export your database.

But we recommend choosing ‘Quick’ and then clicking the ‘Go’ button to download your database.

Export WordPress database using phpMyAdmin

Step 2: Upload WordPress Files to Live Site

Now, we will need to move all your website files to the live site.

To get started, go ahead and open your FTP client and connect to your web hosting account.

Once you are connected to your live site, make sure you upload the files in the right directory. For example, if you want the site to be hosted on ‘yoursite.com’, then you will want to upload all the files in your public_html directory.

Now select your local WordPress files and upload them to your live server.

Upload WordPress files FTP

Step 3: Create a MySQL Database on Your Live Site

While your FTP client is uploading your WordPress files, you can start importing your database to the live server.

Most WordPress hosting providers offer cPanel to manage your hosting account, so we will show you how to create a database using cPanel.

First, you need to log in to your cPanel dashboard and click on the ‘MySQL Database Wizard’ icon, which can be found in the ‘Databases’ section.

Select MySQL database wizard

On the next screen, you can create a new database.

You need to provide a name for your database, then click ‘Create Database’.

Name and create new database

cPanel will now automatically create a new database for you.

Next, you need to enter a username and password for your new user, and then click ‘Create User’.

Create new database user

After that, you need to add the user you just created to the database.

First, check the ‘All Privileges’ checkbox.

Check all privileges checkbox

Then, scroll down and click ‘Make Changes’ to save your changes.

You’ve successfully created a new database for your live WordPress site.

Step 4: Import WordPress Database to Live Site

The next step in the process is to import your WordPress database.

Go to your cPanel dashboard, scroll down to the ‘Databases’ section, and click on ‘phpMyAdmin’.

Click on phpMyAdmin

This will take you to phpMyAdmin, where you want to click on the database you just created above. phpMyAdmin will show your new database with no tables.

Next, click on the ‘Import’ tab in the top menu. On the import page, click on the ‘Choose File’ button and then select the database file from the local site you saved in the first step.

Import database via phpMyAdmin

After that, click the ‘Go’ button at the bottom of the page. Your database will automatically be imported to phpMyadmin.

Step 5: Change the Site URL

Now, you need to change the site URL in your database so that it will connect with your live WordPress site.

In phpMyAdmin, look for the wp_options table in your database that you just imported above.

If you changed your database prefix, then instead of wp_options, it might be {new_prefix}_options.

Next, click on the ‘Browse’ button next to wp_options. Or, click the link in the sidebar to open up the page that has a list of fields within the wp_options table.

Browse the wp options table

Then, in the options_name column, you need to look for the siteurl option.

Then, click the ‘Edit’ icon.

Edit siteurl in phpMyAdmin

This brings up a window where you can edit the field.

In the input box for option_value, you’ll see the URL of your local install, which will be something like http://localhost/test.

You need to insert your new site URL in this field, for example: https://www.wpbeginner.com.

Then, you can save the field by clicking the ‘Go’ button.

edit the siteurl field

Next, you need to follow the same steps as above for the home option name. The wp_options menu can be a few pages long. Usually, the home option will be on the second page.

Then, update the home URL, so it’s the same as your live site URL.

Step 6: Set Up Your Live Site

Now that you’ve imported the database and uploaded your content, it’s time to configure WordPress.

At this time, your site should be showing an ‘Error establishing a database connection‘ error.

To fix this, connect to your website using an FTP client and open up the wp-config.php file.

You’ll be looking for the following lines of code:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

You will need to provide the database name, username, and password you created earlier.

Next, save the wp-config.php file and upload it back to your WordPress hosting server.

Now, when you visit your website, it should be live.

After that, you need to log in to your WordPress admin panel and go to the Settings » General. Then, without changing anything, scroll to the bottom and click the ‘Save Changes’ button.

Save general settings

This will make sure that your site URL is corrected anywhere else that it needs to be.

Once you’ve done that, go to Settings » Permalinks, then scroll down and click ‘Save Changes’ to ensure that all post links are working fine.

Save permalinks settings

Whenever you are moving a WordPress site from one domain to another or from a local server to a live site, you’ll face broken links and missing images.

A simple way to update the URLs is by using the following SQL query:

UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/', 'www.yourlivesite.com/');

Simply go to phpMyAdmin, click on your database, and then click on ‘SQL’ from the top menu and add the query above.

Make sure you change it to your own local site and live site URLs and click the ‘Go’ button.

Fixing WordPress images and broken URLs after moving to live site

That’s it. You have now successfully migrated WordPress from your local server to a live site.

Hopefully, your live website is up and running smoothly. If you notice any errors, then you can check out our guide to common WordPress errors for help with troubleshooting.

We hope this article helped you move WordPress from a local server to a live site. You may also want to see our guide on how to create an email newsletter the right way or see our comparison of the best GoDaddy hosting alternatives.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

909 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. sam says

    Isn’t it better to use a duplicator plugin instead of taking all this trouble as described in here
    or here
    I think using the duplicator is a easier. Feel free to add or correct me.

  3. fadilah says

    hi, i’m getting a problem with my permalink, my permalink is still pointed to my localhost something like fadil.dev so when i add a post/page, the permalink is pointed to my fadil.dev/?p=ID it should be pointed to fadil.com (my real domain) and not fadil.dev (my local domain) .. where i can find the configuration ? help me .. thankyou :)

  4. prox says

    nice tutorial i was thinking to do and found your website luckily and also i would like to ask two thing

    1. what’s this footer advertisement option is it a plugin ?

    2 what’s the plugin your using for newsletter i saw when i enter to your site there’s nice pop up banner that saying do you want to lean about WordPress and then enter your email address

    please share if you don’t mind

    thank you

  5. Nathan says

    Great help, thanks!

    One question, if I buy a theme, can I use it on both my local and live site even though they are different installations and thus have different WordPress id’s?

    I am building my first live site but I have set up a local to play with the designs and construct the content.

    Thanks.

  6. Matt says

    Hi. Firstly I’d like to thank you, this process was easy to understand and errorless on your end!

    My one hang-up was at the very end. I put in the SQL code in order to fix some linking errors, but must not have put the right local host because some small inconsistencies were not fixed. I have been using MAMP and accessing my site by going to “localhost:8888” Is this what I should put in that Step 7 code, or is there a different path?

    • WPBeginner Support says

      Matt first you need to make sure that inside your wp_posts table you are using localhost:8888 inside post content. If yes, then use this in the step 7. If you are seeing all your links as localhost, then use localhost.

      Admin

  7. Dayomaks says

    All instructions works fine, thanks, i am so glad, but the issue i am having now is importing my database…while trying to import my database to a live server i got these errors below:

    Error
    SQL query:


    — Database: `soundmode`

    — ——————————————————–

    — Table structure for table `xs_commentmeta`

    CREATE TABLE IF NOT EXISTS `xs_commentmeta` (

    `meta_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `comment_id` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT ‘0’,
    `meta_key` VARCHAR( 255 ) DEFAULT NULL ,
    `meta_value` LONGTEXT,
    PRIMARY KEY ( `meta_id` ) ,
    KEY `comment_id` ( `comment_id` ) ,
    KEY `meta_key` ( `meta_key` )
    ) ENGINE = INNODB DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

    MySQL said: Documentation

    #1046 – No database selected

    ANY ASSISTANCE ON THERE?

  8. Christie Bellah says

    This worked great, thanks! In the past I had installed WordPress in the new hosting, dropped database tables, imported, etc. – this is so much faster and simpler.

  9. Stefano says

    First of all, thanks for the tutorial – invaluable and well written.

    Unfortunately, I managed to get stuck anyway.
    I uploaded everything via filezilla and phpmyadmin, and when i try to go to my domain it doesn’t show up any error. But nothing else, either.

    Just a blank page – which is weird, because by typing /wp-admin at the end of the url i DO have access to the wordpress control panel, and every page seems to be all right.

    Sorry to bother, but I really have no clue about what’s happening..
    Thanks in advance!

    • Stefano says

      Solved!
      Apparently, it had some issues with the theme loading.
      I couldn’t use the children theme i had worked on, but luckily I had changed just a couple of thing, so no big deal..

      • Stefano says

        I did, and in fact the url worked (even if it showed just a blank page).
        I still have no clue about what happened, but setting up the theme again solved it.
        Lucky shot =P

  10. javed choudahry says

    Hi
    Sir

    Thanku so much .This website is very good for wordpress learn and very help full .

  11. sesan says

    please am having an error from step 4
    SQL query:


    — Database: `wordpress`

    CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

    MySQL said: Documentation
    #1044 – Access denied for user ‘Admin7393’@’%’ to database ‘wordpress’

    • WPBeginner Support says

      Sesan, the export file prepared by phpmyadmin to import into your live site database, contains a line to check if a database exists if not then it tries to create it. To resolve this issue, you need to extract the zip archive you created. Inside it you will find a file with .sql extension. Open this file in a text editor like Notepad and then delete these lines

      CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

      Below this line you will see another line like this

      USE `wordpress`;

      Replace wordpress with the name of the database you are trying to import into.

      Save your changes and put the sql file back into a zip archive (if it is too big, other wise you can also import it as it is).

      Admin

  12. Tyler says

    Hi, thanks for the tutorial!

    I’m struggling with Step 2. Your tutorial shows several files/folders being uploaded whereas I only have wordpress.sql.gz from Step 1. I can’t seem to extract the file using any software but can open using a text editor.

    Any help would be greatly appreciated!

  13. Mario says

    do I need a cpanel to do this procedure? I am using a plugin to backup and export databases already, unfortunately the host provider that the client is using does not have a cpanel.

  14. Rhomy Prama Dhieka (Web Designer) says

    thanks for sharing.
    it help me alot migrating my wp website.
    would you mind if i translte this to my language, then i will put ur credit there ?
    thanks.

  15. ryan says

    hi, i am using stablehost and have used them before with WP websites. I followed all your steps and I am getting a parked page from my hosting provider…

    • WPBeginner Support says

      There can be several reasons for that. First make sure that you have installed WordPress in the root directory of your website. If you did then make a backup of your .htaccess file and delete the one from root directory of your website. If that doesn’t work, then find the default parked page files there might be an index.html file on your web server delete that file (Do Not delete index.php). If none of these help then contact your hosting provider.

      Admin

  16. Alex says

    Thanks!

    I did a search for the ‘‹’ character in the extracted .sql file, but got an alert saying: The string ‘‹’ was not found.

    I don’t know if this matters, but I noticed that my local phpMyadmin version is 5.5.3, while my host’s phpMyadmin version is 3.5.8.2.

    Another note is that I had all my WordPress files already up on my public_html directory (which is your step 2) BEFORE exporting my local WordPress database (which is your step 1). I’m not sure if it makes a difference.

    I’ll try starting over with step 1, as you suggested, and if I get the same error then I may try the Duplicator plugin that you mentioned.

    Alex

  17. PatoPanichelli says

    You really helped me. This step by step is awesome, I had no problems migrating from MAMP to a live site. Thanks

  18. Alex says

    Thanks for the tutorial!

    Everything’s gone well until I get to the end of step 4. When I press the Go button at the bottom of the page, instead of having phpMyadmin import my WordPress database I get an error message that reads as follows:

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‹’ at line 1

    Can you let me know what you think may be causing this?

    Alex

    • WPBeginner Support says

      Alex, it seems like the database file you are trying to import has a character ‘‹’ which is not supposed to be there. You have two options to fix that, first option is go back to your localhost/phpmyadmin and export your local database again and then try to import it again. If the same error occurs again, then extract your database gzip file using 7zip program. Open the .sql file in a text editor like notepad and look at the first line. Also take a look at our database management using phpMyAdmin guide to learn more.

      Admin

    • Anna says

      Make sure you clicked on the database name on the lefthand side that you’d like to import to. Make sure that is highlighted and then try again. (phpMyAdmin version 4.0.8).

  19. qs says

    I get this error when I import datebase into live site. How do i solve it?

    Error
    SQL query:

    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

    /*!40101 SET NAMES utf8 */;


    — Database: `wordpress`

    CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

    MySQL said:

    #1044 – Access denied for user ‘bossaballsg’@’10.%’ to database ‘wordpress’

      • Chathuranga says

        Hi,

        Hope your DB name is “wordpress”

        Change the,
        – Database: `wordpress`

        CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

        change “wordpress” to your live DB name. It’s at your sql file.

      • qs says

        I checked and all the privileges are already set to “yes”.

        is it because of the “latin1_swedish_ci” collation in my database? because the rest of the tables are all in “utf8_general_ci”

      • qs says

        I checked and all the privileges are already set to “yes”.

        is it because of the “latin1_swedish_ci” collation in my database? because the rest of the tables are all in “utf8_general_ci”

  20. fab says

    hi there,
    totally newbie here. hope you can help with this error message during step 4:
    Error
    SQL query:


    — Database: `information_schema`CREATE DATABASE `information_schema` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
    MySQL said:

    #1044 – Access denied for user ‘renta730’@’localhost’ to database ‘information_schema’

    When setting this user I allowed all privileges to the database previously created (named “inicial”).
    Any thoughts?

  21. neha says

    Hi,Nice tute,but can u plz tell how to change database name and password etc from wordpress from live server?

    • WPBeginner Support says

      To change database username and password connect to your live website using an FTP client. Find wp-config.php file and edit it. You will see your database name, database username, and host information. Change it to the database information for your live site.

      Admin

      • Kerry O'Connor says

        I’ve tried every variation of my ‘host url’ in the wp.config file and uploaded it every time, no avail, still getting ‘Error Establishing db..’

        Where before it was ‘localhost’, now it should be ‘mywebsite.com’, is that right?

        thanks

  22. Mohammadreza says

    Best ever, I really appreciate your clear explanation. you’ve got your new follower for sure :)

  23. Changdeo Mhaske says

    Thank You,

    would only make sense if this is a new site. If it is an existing site, then you would have to constantly comment out the hosts file in order to access the live site.

  24. Justin Esparza says

    Thank you very much for this clear concise how-to. It helped immensely. You have a new follower.

  25. Satyanarayana says

    Hi Dude.
    Actually i followed the process as you explaned above is very nice and clear.
    but i was getting the error “page not found”. when i click on link in a website
    i am changing my files from main server to localserver
    Can you please help

  26. Carol says

    New to WP and completely lost. But I managed my first migration thanks to this article.
    Thank you! Thank you!

  27. Steve says

    As a beginner, I found this article very helpful, but couldn’t get my site up live after developing locally. Everything was fine until Step 6. I did see the Error Establishing Database Connection error, and then edited the wp-config.php file. However, my site became a blank screen at that stage and I haven’t been able to change it.

    I continued on and went to my WordPress admin panel, and checked Settings » General. They still showed the localhost web address so I changed it to my site url. This is when things turned ugly. I was automatically logged out of WordPress and can’t get back in. In fact, when I ask WordPress to email me a new password to log in, its sends a localhost URL that takes me to a sign-on page with a message that reads “Sorry, that key does not appear to be valid.” I have no idea what caused that.

    Any help would be greatly appreciated.

      • Steve says

        Thanks for your suggestion. I double-checked and yes I had completed that step. Both have the correct URL

        Part of my confusion is that I now have two databases for this website. I originally had one accessible through a URL that starts with the number of an IP Address/phpmyadmin. Then I have the one I created in Step 3, which I did through my hosting company’s e-panel. They have different passwords and names. But I’ve tried both combinations in the wp-config file and still get the blank screen. Which one of these databases should I be using? They seem to have identical content.

    • Patrick says

      Sparky!
      Your step-by-step guide was spot on. I am a mac user, and after MAMP, I am live now. Thanks a lot. It worked perfectly for me.
      Hat docked!

  28. Vishal Kumar says

    I have done migration form live site to localhost successfully. But I noticed that Comment facility is not there after this. I have also checked all the option in ‘Setting->Discussion’ page. Everything is cheked but Commenting option and Leave comment box is not visible anywhere in the localhost. Please give me any suggestion for this because I am new in wordpress I am a Zend framework developer basically.

  29. NARESH says

    Instead of moving the wordpress site, I would like to fresh install wordpress using fantastico or hostgator’s quick install, so will I be able to do like this too just by exporting and importing databases and uploading the themefiles? or this is the only way we can do it?

    I don’t know why. my local machine wordpress loads very slow than one, whichever is installed on live server using fantastico or quick install.

    • WPBeginner Support says

      Naresh yes you can import your posts and comments using import/export tools in WordPress, then you can upload theme and other files using FTP. There are multiple ways to do things you need to choose one that works best for you.

      Admin

  30. Mark Jones says

    Do all of these instructions remain the same if there’s already an older, existing, non-wordpress page built where you want to move your wordpress page? For instance, rebuilding an existing site as a wordpress site, then switching over.

  31. Abrishca says

    It’s easy to forget just how much work a good plugin really does for us – I personally use the Duplicator plugin to transfer new websites from my development server to the client’s domain and you can see how much time this plugin (and Backup Buddy) can save you.

  32. Praveen says

    Hi,
    I am facing problem in changing the database after creating the new database.
    Is there any problem with my hosting service or anything else

  33. Anna says

    Are you reading my mind?! Just a little while back I sat down at the computer to figure out how to add a Facebook like button to my first website, currently in development. Whala! “How to add a Facebook like button to your posts” was that day’s article. Then I’m wondering how to begin the local to live migration today, and AGAIN, here’s this post! GET OUT OF MY HEAD! :)

    And seriously, thank you very much for the invaluable help you’ve given to a beginner like myself.

  34. riaz ali shah says

    great article, the technique i often use for develop wordpress sites for clients, i use dummy text and images for local and then i move my theme only on server.

  35. John Coleman says

    This was a great article. Another option to address the broken links issue is to do a find/replace on your .sql file (in a text editor) of the local URL to the production URL before you import it. This is also handy when moving a site to/from a sub-directory, or to push from staging (e.g. http://staging.domain.com) to production (e.g. http://www.domain.com).

    Thanks for putting this out there. I am sure it will help a lot of people.

  36. David says

    Could have used this article 20 months ago. The trick I discovered in making the move was to open the database file in a good text editor. From there I did a search & replace maneuver to change localhost to the proper URL. It discovered numerous instances without me tracking down the tables, or worrying if my command syntax was correct.

    There’s a plugin called Broken Link Checker that’s worth running as well after the move.

    There are some web-hosting sites who’s infrastructure keeps everything in your WordPress site as localhost. No need to change anything in your local build. Just copy it over. Will definitely chose one of them next time.

  37. Mark says

    2 suggestions to make it easier to move:

    1. When developing locally edit your HOSTS file (c:\Windows\System32\Drivers\etc\hosts) to point your domain name at local server. This avoids having to change the SITE URL and other links/images. Note: this will require config changes to your local web server.

    2. If you have to modify the SITE URL etc, after you have exported the local database and before import, Open the file in notepad and search for all instances of localhost/yourtestsite and replace with http://www.yourlivesite.com

    • Editorial Staff says

      Mark,

      1. would only make sense if this is a new site. If it is an existing site, then you would have to constantly comment out the hosts file in order to access the live site.

      2. Yes that would make sense.

      Admin

      • Mark says

        Changing the hosts file is something I do quite often and have a shortcut on my desktop giving me quick access.

  38. Gregg says

    I also recommend DeskTop Server which I have been using for more then a year. Desktop Server allows you to create a local version of your site and then direct deploy it. Awesome!

  39. Sü Smith says

    Great post! I typically just do find and replace on the .sql file with Notepad++ before uploading it to phpmyadmin. This is a nice alternative.

  40. Mike Ott says

    Unfortunately this only works for some sites. A lot of wordpress plugins store serialised data in the database (Gravity Forms is one such plugin), and serialised data isn’t portable so doing an SQL dump and importing via PHPMyAdmin won’t work properly because of the string length differences between your local URL and live domain. You can’t even run an SQL query over serialised data.

    The best thing I’ve found to get around this problem is by using the WP Migrate DB plugin (http://wordpress.org/plugins/wp-migrate-db/). It handles the serialised data problem flawlessly every time and you won’t have to do half the other things you mentioned in this post.

    Have fun.

    • Mark says

      Just had a light bulb moment! I have run into this issue before, thanks for the heads up Mike and pointer to the plugin,

    • Augustas says

      For replacing paths and URLs I always use “Search and Replace” tool ( http://goo.gl/MCsKl ). It replaces serialized data, and it can be used for other CMSs as well, not only for WordPress.

  41. estudiowp says

    Nice article an well explained steps!

    However, many people will find troubles in their migrations because of the serialized data.

    Some plugins and themes use serialized data, and the replaces in step 5 and step 7 won´t change all the urls and paths that need to be changeed.

    For those steps you could use these tools or plugins:

    · wp migrate db plugin: http://wordpress.org/plugins/wp-migrate-db/

    · search and replace tool: http://interconnectit.com/products/search-and-replace-for-wordpress-databases/

    I hope this comment will be useful and sorry for my english!

  42. Jean says

    Great article – best I’ve read on this subject.

    I moved a site a while back and the only thing I would add is that you might need to re-save the permalinks settings. I had to do this because none of my menu links worked so this was an easy fix (luckily!)

    • Mike Ott says

      If anyone wants to know what that happens, it’s the .htaccess file shows a different RewriteRule between local and live.

      A quick edit to .htaccess fixes the problem or as Jean pointed out, re-saving the permalinks settings will also do the trick as it’s just fixing the RewriteRule.

Leave a Reply to sesan Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.