Guides

How to Migrate WordPress from Localhost to a Live Server (Plugin and Manual Methods)

Move a WordPress site from XAMPP, Local or MAMP to live hosting: plugin method, manual files and database method, fixing URLs, and launch checks.

On this page
  1. Before you start
  2. Method 1: move it with a migration plugin
  3. Method 2: move it by hand
  4. Launch checks people skip
  5. Edge cases
  6. FAQs
Key takeaways
  • Moving WordPress from localhost means copying files and database to the host, updating wp-config.php and replacing localhost URLs with a serialisation-safe tool.
  • A migration plugin such as Duplicator or All-in-One WP Migration handles all three for most small sites; the manual phpMyAdmin method suits larger ones.
  • After launch, untick Discourage search engines, check for leftover localhost links, change the admin login and set up email and backups.

To migrate WordPress from localhost to a live server, copy the site's files and database to your hosting, point wp-config.php at the new database, and replace every http://localhost/... address with your real domain using a serialisation-safe search and replace.

A migration plugin does all three for you, and works for most small sites. The manual method is for big sites or when a plugin's upload limit gets in the way. Both are below, followed by the checks people forget on launch day.

Before you start

  • Hosting with a domain connected and SSL issued. Install the free certificate first so the live address is https:// from day one.
  • Your local site working, with the same PHP version as the host, or close to it. Check Tools > Site Health > Info > Server locally and the PHP setting in your hosting panel.
  • An empty database on the host (for the manual method), with its name, user and password noted.

Method 1: move it with a migration plugin

  1. Install fresh WordPress on the live host using the host's installer, for example hPanel > Websites > Add Website or Softaculous in cPanel.
  2. On your local site, install a migration plugin such as Duplicator, All-in-One WP Migration or Migrate Guru (Migrate Guru needs the source to be reachable online, so it isn't suited to a site on your laptop).
  3. Create the export. In Duplicator go to Duplicator > Packages > Create New and download both the installer and the archive. In All-in-One WP Migration use All-in-One WP Migration > Export > Export To > File.
  4. Import on the live site. For All-in-One WP Migration, install it on the live site and use Import. For Duplicator, upload installer.php and the archive to the site folder over File Manager, then open yourdomain.com/installer.php and follow the steps.
  5. Let the plugin replace the URLs. Both plugins swap the localhost address for the live one automatically.
  6. Log in and resave permalinks at Settings > Permalinks > Save Changes.
  7. Delete the installer files and old archives from the server, which Duplicator offers to do for you.

If the import stops because the file is too big, raise the limit (see increase the WordPress upload size) or switch to the manual method.

Method 2: move it by hand

  1. Export the database. Open phpMyAdmin locally (in XAMPP it is http://localhost/phpmyadmin; in Local use Database > Adminer), select the site's database, then Export > Quick > SQL > Export.
  2. Zip the files. Compress the whole site folder, for example C:\xampp\htdocs\mysite or the app/public folder in Local.
  3. Upload and extract. In the hosting File Manager, open public_html (or the domain's folder), upload the ZIP and click Extract. Make sure wp-config.php ends up directly inside the folder, not one level down.
  4. Import the database. Open phpMyAdmin from the hosting panel, select the new empty database, then Import and choose the SQL file.
  5. Edit wp-config.php. Change DB_NAME, DB_USER, DB_PASSWORD and DB_HOST to the host's values. DB_HOST is often localhost on shared hosting, but some hosts give a different hostname.
  6. Check the table prefix. $table_prefix in wp-config.php must match the prefix of the imported tables, for example wp_.
  7. Replace the URLs safely. Don't do a plain find and replace on the SQL file, because WordPress stores some settings as serialised data with character counts, and changing the length breaks them. Use WP-CLI (wp search-replace 'http://localhost/mysite' 'https://yourdomain.com' --all-tables) if the host offers SSH, or log in and use the Better Search Replace plugin under Tools > Better Search Replace, doing a dry run first.
  8. Resave permalinks so the .htaccess file is rebuilt for the live server.

If you can't log in because the site redirects to localhost, set the two addresses directly in wp-config.php for now: define( 'WP_HOME', 'https://yourdomain.com' ); and define( 'WP_SITEURL', 'https://yourdomain.com' );. Remove them once the search and replace is done.

Launch checks people skip

  1. Turn search engines back on. Local sites are often set to hide from search. Untick Settings > Reading > Discourage search engines from indexing this site.
  2. Look for mixed content. Images with http://localhost in page builder data or theme options don't always get replaced. Open a few pages, check the browser console, and run the search again for localhost.
  3. Regenerate builder files. In Elementor use Elementor > Tools > Regenerate Files & Data, then clear any cache.
  4. Change the admin password and email. Local installs often use "admin" and a weak password. Check Users and Settings > General for the admin email.
  5. Set up email sending so contact forms work; see WordPress not sending emails.
  6. Add backups before you make any more changes.

Edge cases

  • Port numbers. Local by Flywheel and MAMP use addresses like http://localhost:8888 or http://mysite.local. Search for exactly what is in Settings > General, including the port.
  • Windows line endings and case. Windows ignores capital letters in file names; Linux servers don't. An image saved as Logo.PNG but linked as logo.png works locally and breaks live.
  • Database collation errors. A newer local MySQL may export utf8mb4_0900_ai_ci, which older hosts reject. Replace it with utf8mb4_unicode_ci in the SQL file before import.

Prefer to hand it over? Our WordPress migration service moves local, staging and live sites with the URL, SSL and email checks done for you. For the difference between local and staging copies, see staging sites explained.

FAQs

Can I upload a localhost WordPress site to Hostinger?

Yes. Either install WordPress through hPanel and import with a migration plugin, or upload the files through File Manager and import the database in phpMyAdmin as above.

Why are my images missing after moving from localhost?

Their addresses still point at localhost, or the uploads folder wasn't copied. Run the search and replace again and check /wp-content/uploads/ exists on the server.

Do I need to install WordPress on the server first?

For plugins like All-in-One WP Migration, yes. For Duplicator's installer or the manual method, no; you upload your own files.

Need help with your website?

I'm a freelance WordPress developer building fast, SEO-friendly websites since 2020. Tell me what you need and I'll reply with a plan and a fixed quote, usually within 24 hours.

Found this useful? Share it:
Contact

Let's build your next website

Available for freelance projects, agency white-label work and long-term maintenance. Feel free to pass this along to your team or company.

I reply within 24 hours, usually the same day. Your details are emailed to me, then WhatsApp opens so we can chat right away.

Chat now