How to Move a WordPress Site from Localhost to Live Hosting
Building a WordPress site on your own computer first is a smart, safe way to work. When it is ready, going live comes down to three steps: move the files, move the database, and update the URLs so WordPress knows it now lives at your real domain. Miss that last step and you get broken links and login loops — so we will be careful with it.
Step 1: Move the files
Zip your local WordPress folder, upload it to your domain's document root using File Manager, and extract it there.
Step 2: Move the database
- Export your local database (from your local phpMyAdmin).
- On your hosting, create a new MySQL database and user.
- Import your export into the new database.
Step 3: Update wp-config.php
Edit wp-config.php on the live server and set the database name, user and password to the new ones you just created. This connects WordPress to its data in the new home.
Step 4: Update the site URLs
Your local site used something like http://localhost/mysite; the database is full of those references. Replace them with your live domain using a proper search-and-replace tool (a WP-CLI search-replace, or a migration plugin's URL update) so serialised data is handled safely. Our guide on changing your WordPress site URL covers this, and duplicating a WordPress site manually mirrors the same process.
Step 5: Final checks
- Set up SSL and confirm the padlock.
- Fix any mixed-content warnings.
- Clear caches and click through the site.
Frequently asked questions
Is there an easier, plugin-based way?
Yes. Migration plugins package your whole local site into one file and restore it live, handling URLs automatically. See UpdraftPlus, which can restore to a new location.
I moved everything but see "Error establishing a database connection".
The credentials in wp-config.php do not match your new database. Recheck the name, user, password and host, and confirm the user is assigned to the database.
My homepage loads but other pages 404.
Go to Settings → Permalinks and click Save to rebuild the rules, and make sure your .htaccess file is present.
Was this article helpful?