Moving WordPress From Localhost to a Live Server
Are you ready to take your WordPress site from localhost to live? Moving a WordPress website from your local development environment to a live server is an important step. In this article we explain how to get WordPress from localhost to live without anything going wrong.
You've built a nice WordPress site locally with XAMPP, LocalWP or MAMP. Now it's time to go live. The migration takes a few steps, but with this guide you'll manage it.
How do you prepare?
Before you start, make sure you have:
- Hosting with WordPress support
- FTP credentials or file manager access
- Database details (name, user, password)
- Your local WordPress files
- Your local database export
Step 1: Export your files
Copy your entire WordPress installation from your local server. This is usually:
- XAMPP: C:\xampp\htdocs\yoursite\
- MAMP: /Applications/MAMP/htdocs/yoursite/
- LocalWP: Go to the site, right-click, "Go to site folder"
You need the complete wp-content folder, wp-config.php, and all other files.
Step 2: Export the database
- Open phpMyAdmin locally (usually localhost/phpmyadmin)
- Select your WordPress database
- Click "Export"
- Choose "Quick" and format "SQL"
- Click "Go" and save the .sql file
Step 3: Create a database on your hosting
- Log in to your hosting panel (DirectAdmin/cPanel)
- Go to "MySQL Databases"
- Create a new database
- Create a user and link them to the database
- Note down: database name, username, password
Step 4: Import the database
- Open phpMyAdmin on your hosting
- Select the new empty database
- Click "Import"
- Choose your .sql file
- Click "Go"
Step 5: Update URLs in the database
Your database still contains "localhost" URLs. These need to point to your live domain. Use one of these methods:
Via phpMyAdmin (simple)
- Go to the wp_options table
- Look for "siteurl" and "home"
- Change both from localhost/yoursite to https://yourdomain.com
Via the Search Replace script (more thorough)
Download "Search Replace DB" from interconnectit.com. This replaces URLs throughout the whole database, including serialized data.
- Upload the Search Replace folder to your server
- Open in your browser: yourdomain.com/Search-Replace-DB/
- Enter the old URL: http://localhost/yoursite
- Enter the new URL: https://yourdomain.com
- Click "dry run" to test
- Click "live run" to execute
- Delete the folder afterwards!
Step 6: Upload your files
- Connect to your hosting via FTP
- Navigate to public_html (or your document root)
- Upload all WordPress files
- This can take a while for large sites
Step 7: Update wp-config.php
Open wp-config.php and change the database details:
define( 'DB_NAME', 'your_database_name' );
define( 'DB_USER', 'your_database_user' );
define( 'DB_PASSWORD', 'your_database_password' );
define( 'DB_HOST', 'localhost' );
Upload the modified file to your hosting.
Step 8: Re-save your permalinks
- Log in to your live WordPress (yourdomain.com/wp-admin)
- Go to Settings → Permalinks
- Click "Save Changes" (without changing anything)
This regenerates your .htaccess file.
Checking everything
Go through your site and check:
- Do all pages work?
- Do images load correctly?
- Does the contact form work?
- No more localhost links left in the source code?
Common problems
White screen
The database details in wp-config.php are incorrect. Check them again.
Images not loading
URLs in the database haven't been replaced yet. Run the search-replace again.
Error establishing database connection
The database name, user or password is incorrect. Or the user doesn't have permissions on the database.
Migration plugins
Prefer to automate it? Plugins like All-in-One WP Migration or Duplicator can handle the whole process for you.
Going live at Theory7
Detailed step-by-step plan
Step 1: export your local site
Download all WordPress files from your local installation. These are the wp-content, wp-admin, wp-includes folders and the loose files in the root. Also export the database via phpMyAdmin as an SQL file.
Step 2: prepare your live hosting
On your hosting plan:
- Create a database and note down the name, user, password and host
- Make sure the correct PHP version is active (the same as locally)
- Note the public_html or httpdocs folder where your files will go
Step 3: upload your files
Upload all WordPress files via FTP or the File Manager in your hosting panel. This can take a while for a large site. You could compress everything into a ZIP and extract it on the server, that's often faster.
Step 4: import the database
Import your SQL file via phpMyAdmin into the new database. For large databases this can take time or even time out. Your hosting may have an import tool, or you can import via SSH.
Step 5: update wp-config.php
Open wp-config.php and change the database settings:
- DB_NAME: the name of your new database
- DB_USER: database username
- DB_PASSWORD: database password
- DB_HOST: usually localhost, sometimes a specific server
Step 6: replace URLs
This is the crucial step many people forget. Your database contains your local URL everywhere (localhost:8888 or local.test). These need to be replaced with your live URL.
Use the Better Search Replace plugin or WP-CLI:
wp search-replace 'http://localhost' 'https://yoursite.com' --all-tables
Note: don't use a standard search-replace in phpMyAdmin, that breaks serialized data.
Common problems
White screen or error 500
Usually a database connection error. Check wp-config.php. Enable debug (WP_DEBUG true) to see the error.
Images not loading
The URLs still point to localhost. Run the search-replace again and check that you included all tables.
Can't log in
Sometimes it helps to reset the permalinks. Temporarily add this to wp-config.php:
define('RELOCATE', true);
Remove it again after logging in.
Mixed content warnings
Some URLs are http while your site is https. Run the search-replace from http://yoursite.com to https://yoursite.com.
Migration plugins as an alternative
If a manual migration seems too complex, there are plugins that simplify the process:
Duplicator
Creates a package of your entire site that you extract on the new server. The free version is suitable for most sites.
All-in-One WP Migration
Exports your site as a single file that you import at the new location. Very user-friendly.
UpdraftPlus
Primarily a backup plugin but also suitable for migration. Make a backup, restore it on the new site.
Common migration problems
- Memory limits: increase memory_limit in php.ini for large sites
- Timeout: increase max_execution_time for long imports
- File size: split large exports or use the command line
After the migration
Checklist for after your migration:
- Check all pages and posts
- Test forms
- Check images
- Check links
- Test admin functions
- Re-save permalink settings
A WordPress migration from localhost to live may seem complex, but it's very doable with the right steps. Take your time, make backups and test thoroughly.
Moving WordPress from localhost to a live server is an important step in your development process. With the right preparation and tools, the migration goes smoothly.
Take the time to thoroughly test everything after the migration. Check all pages, forms, links and images. Also view your website on different devices and browsers. Only once everything works can you clean up the old test environment and focus on expanding your live website.
From localhost to live is a milestone in every web project. With careful preparation and thorough testing, the launch goes smoothly. Double-check everything and celebrate the moment your website goes live for the real audience.
Going from local to live is an exciting moment. Prepare well, test thoroughly and celebrate the launch of your new website.
WordPress localhost to live: complete checklist
Use this checklist to make sure your WordPress localhost to live migration is complete. A structured approach prevents you from forgetting steps.
| Step | Action | Status |
|---|---|---|
| 1 | Local backup made (files + database) | Check |
| 2 | Hosting and domain ready | Check |
| 3 | Database created on live server | Check |
| 4 | Database exported and imported | Check |
| 5 | Files uploaded via FTP | Check |
| 6 | wp-config.php updated | Check |
| 7 | URLs replaced (search-replace) | Check |
| 8 | Permalinks re-saved | Check |
| 9 | SSL activated | Check |
| 10 | All pages and links tested | Check |
WordPress localhost to live: optimizing speed after migration
After moving WordPress from localhost to live you might notice your site loads slower than locally. That's normal, because locally you have no network latency. Here are tips to optimize your live site:
Enabling caching
Install a caching plugin like WP Super Cache, W3 Total Cache or LiteSpeed Cache. Caching stores a static version of your pages so the server has to do less work on every visit.
Optimizing images
Locally you might worry less about file sizes, but on a live server every kilobyte counts. Use a plugin like ShortPixel or Imagify to compress images without visible quality loss.
Checking the PHP version
Make sure your live server runs the same or a newer PHP version than your local environment. PHP 8.x is significantly faster than older versions and offers better security.
Optimizing the database
After the migration it can help to optimize the database. Remove unnecessary revisions, spam comments and transient data. The WP-Optimize plugin does this automatically for you.
Need WordPress hosting? Check out Theory7's WordPress hosting plans with pre-installed optimizations for fast load times.
WordPress localhost to live: security after the migration
After moving WordPress from localhost to live you need to pay extra attention to security. It doesn't matter as much in your local environment, but a live site is a target for hackers and bots.
Right after the migration
- Change all passwords: Change the admin password, database password and FTP password. Local passwords are often weak
- Remove test accounts: If you created extra users locally for testing, remove them on the live site
- Remove unnecessary plugins: Plugins you only used locally (debug tools, test plugins) aren't needed on live and increase the attack surface
- Enable SSL: Make sure your site runs fully on HTTPS. Set up a redirect from HTTP to HTTPS
- Install a security plugin: Wordfence, iThemes Security or Sucuri protect your live site against attacks
Securing wp-config.php
Your wp-config.php contains sensitive information. Take these security measures:
- Generate new salt keys via the WordPress salt generator and replace the local keys
- Set WP_DEBUG to false (it may have been true for local development)
- Add
define('DISALLOW_FILE_EDIT', true);to block code editing from the admin - Consider placing wp-config.php one folder above your document root
Good security from the start prevents problems later. Take these steps seriously for every migration of WordPress from localhost to a live environment.
Ready to go live? At Theory7 we're happy to help you with the migration. Get in touch with our support team.
Moving WordPress from localhost to live: frequently asked questions
When taking WordPress from localhost to live, the same questions often come up. It's important to know that when you want to move WordPress from localhost to live, you should always make a backup of your local files first. Many beginners forget to update the URL settings in the database when moving WordPress from localhost to live. After moving WordPress from localhost to live, always check that all links work correctly and that your images load properly. With the right preparation, moving WordPress from localhost to live is a straightforward process.
Checklist: moving WordPress from localhost to live
Use this checklist when you're moving WordPress from localhost to live. This way you make sure you don't forget anything during the transfer.
WordPress localhost to live: solving common problems
When moving WordPress from localhost to live you'll almost always run into known problems. The most common problem is the White Screen of Death after uploading. This is almost always caused by a difference in PHP version. Check which PHP version you run locally and make sure the live server uses the same or a newer version. Enable WP_DEBUG via wp-config.php to see the exact error message.
Another common problem is that links and images don't work. WordPress stores absolute URLs in the database. Every reference to localhost needs to be replaced with your live domain name. Use WP-CLI or the Better Search Replace plugin for this. Never do a direct search-and-replace in the database, as this damages serialized data.
Permission problems form the third category. On your local machine you run as admin, but a live server has stricter file permissions. Set folders to 755 and files to 644. Also check whether the .htaccess file was included and whether mod_rewrite is enabled. Without correctly working htaccess rules, clean URLs won't work.
Moving WordPress from localhost to live: migrating the database correctly
The database migration is the most critical part of moving WordPress from localhost to live. Export your local database via phpMyAdmin as an SQL file. Check that the character encoding is correctly set to utf8mb4. Then import the file into the live database.
After importing you need to update the siteurl and home options in the wp_options table. Use WP-CLI with the wp search-replace command for a safe search-and-replace operation that leaves serialized data intact. The command automatically replaces all occurrences of the old URL with the new one.
Thoroughly test after the migration whether everything works correctly. Check the homepage, pages, blog posts, forms and any e-commerce functionality. Also check whether images are displayed correctly and the uploads folder was copied correctly.
Checklist: from localhost to live in ten steps
- Get your hosting ready: Make sure your hosting plan is ready with the correct PHP version.
- Make a backup: Make a full backup of local files and the database.
- Export the database: Export via phpMyAdmin as an SQL file.
- Upload files: Upload all WordPress files via FTP or the hosting panel.
- Import the database: Create an empty database and import your SQL file.
- Update wp-config.php: Update the database name, username, password and host.
- Replace URLs: Use WP-CLI or Better Search Replace to replace localhost URLs.
- Refresh permalinks: Go to Settings, Permalinks and click Save.
- Enable SSL: Install an SSL certificate and force HTTPS.
- Test: Thoroughly test all pages, forms, links and functionality.
By systematically going through this checklist, you minimize the chance of problems and get your website live quickly.
Best practice for future updates after going live
After successfully moving WordPress from localhost to live, it's important to have a good workflow for future updates. Never work directly on the live website. Always make changes first on a local copy or a staging environment and test them thoroughly before putting them live. This prevents a bug in your code from taking down the live website.
Consider using Git for version control. With Git-based deployment you can trace every change, roll back if something goes wrong, and collaborate with other developers. Combine Git with automatic deployment via webhooks so you can send your changes to the live server with a simple push. This is safer and more efficient than manually uploading files via FTP.
Also plan a regular backup schedule. Make daily automatic WordPress backups and test monthly whether your backups can actually be restored. A backup you can't restore is worthless. With a good workflow of developing locally, testing on staging and deploying to live, you minimize the risk of problems and keep your website in top condition.
Finally, an important tip for WordPress localhost to live projects: always keep a copy of your local development environment after going live. Don't remove it right away, since you might need it as a reference if problems come up after launch. After a month of running successfully live, you can archive or remove the local copy. Also check out our article on putting a website online for an alternative step-by-step approach to the publishing process.
Don't forget to secure your website after going live. Install a security plugin, change your default login URL, remove any debug settings from wp-config.php and check that WP_DEBUG is set to false. Submit your website to Google Search Console and configure an XML sitemap so search engines can index your content quickly. With these final steps, your move from localhost to live is fully complete.