Skip to main content

Local to Live

How to Move WordPress From Localhost to a Live Server

Take a site built in XAMPP, WAMP, or Local into production without the classic mistake: forgetting that localhost URLs are baked into the database itself.

Free

Migration help from Hosting Cheap

NVMe

SSD live server storage

24/7

Human support at launch

30-day

Money-back guarantee

In short

To move WordPress from localhost to a live server, export the local database via phpMyAdmin, upload the wp-content folder and core files to the live server, import the database into a newly created live database, update wp-config.php with the live database credentials, and run a search-and-replace to swap every instance of localhost or your local URL for the live domain. Skipping the search-and-replace step is the single most common reason a freshly launched site shows broken images or an admin login loop.

Once URLs are corrected and permalinks are re-saved, the site should behave identically to how it did locally, just reachable by anyone instead of only your own machine.

Building a WordPress site locally with XAMPP, WAMP, MAMP, or Local by Flywheel is the right call — no risk of a public visitor seeing an unfinished page, and everything runs instantly since there's no server round-trip. The catch arrives the moment you're ready to launch: WordPress stores its own site URL directly inside the database, in the wp_options table and often scattered through post content, widget settings, and serialized plugin data. A local build saved that as something like localhost/mysite or mysite.local, and none of that means anything to a live server or to anyone visiting from outside your own computer.

This guide covers the export, upload, and — critically — the search-and-replace step that actually makes a local build function once it's live. It also covers where things typically break: serialized data getting corrupted by a naive find-and-replace, file permissions after upload, and the live-server database credentials that have to go into wp-config.php before anything else will work.

Step One: Export the Local Database Correctly

Open phpMyAdmin from your local stack's control panel (XAMPP and WAMP both bundle it; Local by Flywheel has its own database adminer accessible from the site's dashboard). Select the WordPress database, click Export, choose the Quick export method with SQL as the format, and download the .sql file. This file contains every post, page, comment, and setting, including the localhost URLs you'll need to fix in a later step.

Double-check you're exporting the correct database if your local environment has more than one site set up, since XAMPP and WAMP installs commonly host several local projects under one database server, and importing the wrong one wastes a launch window fixing a completely unrelated site's content.

Step Two: Upload Files to the Live Server

Copy the entire WordPress folder — core files, wp-content with its themes, plugins, and uploads subfolders — from your local htdocs (XAMPP), www (WAMP), or app/public (Local) directory to the live server, typically via FTP, SFTP, or your host's file manager. Large uploads folders with years of media are usually the slowest part of this step, so compressing everything into a single zip locally, uploading that one file, and extracting it on the server is faster than transferring thousands of individual images one at a time.

Once uploaded, set correct file permissions if your host requires it (directories typically 755, files typically 644) and create a new MySQL database plus a database user on the live server through your hosting control panel, since the live server needs its own database, not a copy of your local server's connection.

Step Three: Import the Database and Update wp-config.php

Import the .sql file into the new live database through phpMyAdmin on the live server. Then edit wp-config.php in the uploaded WordPress files, replacing DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST with the live server's actual database credentials, not the local ones (which are commonly root with no password, meaning nothing on the live server). Getting this step wrong produces the 'Error establishing a database connection' message, which is almost always a credentials or hostname mismatch rather than a corrupted import.

At this point the site technically exists on the live server, but it's still configured internally to think its address is your local development URL, which is what the next step fixes.

Step Four: Search-and-Replace Every localhost Reference

This is the step most localhost-to-live guides underplay. WordPress stores its site URL in wp_options (siteurl and home fields), but it also gets written into post content whenever you've inserted an image or internal link, into widget configurations, and into serialized arrays used by many plugins and page builders. A plain text find-and-replace on serialized data corrupts it, because serialized strings include a stored character count that no longer matches after a substring is swapped in or out.

Use a tool built for this — Better Search Replace, WP Migrate, or WP-CLI's search-replace command — all of which understand serialization and update the character counts correctly. Run it once from mysite.local (or localhost/mysite) to your real domain, then flush the permalinks by revisiting Settings > Permalinks and clicking Save, which regenerates the .htaccess rewrite rules for the live server.

How to Move WordPress From Localhost to Live

A Local Build Deserves a Live Server That Matches It

The whole point of building locally first is confidence that the site works before anyone sees it. That confidence only carries over if the live server is fast and reliable, otherwise a smooth local build launches into a sluggish first impression.

Hosting Cheap runs every plan on NVMe SSD with LiteSpeed caching so a site that felt instant in XAMPP still feels instant once it's public, plus free SSL so the live domain is HTTPS from the first visit.

  • NVMe SSD + LiteSpeed keeps the live site as fast as your local build
  • Free auto-renewing SSL secures the domain from day one
  • Free managed migration if you'd rather not run the steps yourself
  • Daily backups protect the freshly launched site immediately

Why Hosting Cheap

What you get

Fast live-server infrastructure

NVMe SSD and LiteSpeed mean the launched site performs at least as well as it did locally.

Free SSL on launch

The live domain gets HTTPS automatically instead of you sourcing a certificate separately.

Free managed migration

Hand off the export, upload, and search-and-replace steps to Hosting Cheap's team.

Daily backups

The freshly launched site is protected from day one against a bad plugin update.

24/7 human support

Get help immediately if the live site shows a database connection error after launch.

1-click WordPress tools

Manage the live installation through a cPanel-style panel instead of raw server access.

How It Works

Get set up in a few steps

1

Export the local database

Use phpMyAdmin to export the local WordPress database as a .sql file.

2

Upload files and import the database

Transfer wp-content and core files, create a live database, and import the .sql file into it.

3

Search-and-replace URLs and flush permalinks

Swap every localhost reference for the live domain using a serialization-safe tool, then re-save permalinks.

Included

Everything you need, on every plan

  • Correct local database identified and exported as .sql
  • wp-content folder (themes, plugins, uploads) fully uploaded
  • New database and database user created on the live server
  • wp-config.php updated with live database credentials
  • Serialization-safe search-and-replace run on all local URLs
  • Permalinks re-saved to regenerate live .htaccess rules
  • SSL active and site loading over HTTPS before sharing the link
  • Local and live versions compared page by page before announcing launch

FAQ

Frequently asked questions

Why does my live WordPress site show broken images after moving from localhost?

Image URLs stored in post content and media library entries still point at your local address until you run a search-and-replace. Use a serialization-aware tool like Better Search Replace or WP-CLI's search-replace rather than a plain text editor.

Can I use a plain text editor to replace localhost with my live domain?

Not safely on the database export file, since WordPress serializes some data with stored character counts, and a manual text swap breaks that count and corrupts the field. Always use a tool designed for WordPress URL replacement.

Why do I get a database connection error after uploading my local site?

This almost always means wp-config.php still has your local database credentials rather than the live server's actual database name, username, password, and host. Update those four values to match the database you created on the live server.

Do I need to reinstall plugins after moving from localhost to live?

No, uploading the wp-content/plugins folder carries the plugin files over, and the database import brings their settings. Just verify each plugin still functions correctly once the site is live, since some check the domain on activation.

Should permalinks be re-saved after moving to a live server?

Yes. Visit Settings > Permalinks and click Save even without changing anything, which regenerates the .htaccess rewrite rules needed for clean URLs to work on the new server.

Can Hosting Cheap move a local WordPress build live for me?

Yes, free managed migration covers moving a local build to a live server, including the database export, file upload, and URL search-and-replace, with 24/7 support if anything needs checking after launch.

Ready to Take Your Build Live?

Launch your local WordPress site on NVMe SSD hosting from $2.09/mo, with free migration if you'd rather not do it yourself.

Get Started