
You’ve built a beautiful WordPress site on your local development environment. Now it’s time to launch it to the world. Moving from localhost to a live server can seem daunting, but with the right steps, it’s straightforward. This comprehensive guide walks you through every step of deploying your WordPress site from local development to production.
Understanding Localhost Development Environments
Before migrating, let’s clarify what you’re working with:
XAMPP: Cross-platform (Windows, Mac, Linux) local server environment. Includes Apache, MySQL, PHP, and Perl. Popular for Windows users. Creates sites accessible at http://localhost/sitename/.
MAMP: Mac/Windows application providing Apache, MySQL, and PHP. Cleaner interface than XAMPP. Mac developers’ favorite. Accessible at http://localhost:8888/sitename/.
Local by Flywheel: Modern local WordPress development tool. Beautiful interface, easy site creation, one-click WordPress installation. Sites run at http://sitename.local/.
WAMP: Windows-only Apache, MySQL, PHP stack. Similar to XAMPP but Windows-specific. Accessible at http://localhost/sitename/.
Docker/Laravel Valet: Advanced options for experienced developers offering containerization and sophisticated local environments.
All these tools create local web servers on your computer where WordPress runs. Your goal: replicate this environment on a live web server accessible to the world.
Pre-Launch Checklist
Before migration, prepare your site:
Content Review: – [ ] Remove test/dummy content – [ ] Check all pages for “lorem ipsum” placeholder text – [ ] Remove “Under Construction” banners – [ ] Verify all images display correctly – [ ] Test all forms and functionality – [ ] Proofread content for typos
Technical Preparation: – [ ] Update WordPress core to latest version – [ ] Update all plugins to latest versions – [ ] Update theme to latest version – [ ] Delete unused themes and plugins – [ ] Optimize database (remove revisions, spam comments) – [ ] Test site thoroughly on localhost
SEO Preparation: – [ ] Install Yoast SEO or Rank Math – [ ] Configure SEO settings – [ ] Set up XML sitemap – [ ] Prepare Google Search Console and Analytics
Backup: – [ ] Create complete backup of local site – [ ] Export database – [ ] Copy all WordPress files to safe location
This preparation prevents launching with embarrassing mistakes or technical issues.
Choosing and Setting Up Web Hosting
If you don’t have hosting yet, select a provider:
Hosting Requirements: – PHP 7.4+ (8.0+ recommended) – MySQL 5.7+ or MariaDB 10.3+ – HTTPS support (SSL certificate) – Sufficient disk space for your site – Adequate bandwidth for expected traffic
Recommended Hosting Types:
Shared Hosting ($3-10/month): Good for small sites, blogs, portfolios. Examples: Bluehost, SiteGround, HostGator. Limitations: shared resources, performance constraints.
Managed WordPress Hosting ($15-50/month): Optimized for WordPress, includes automatic backups, updates, security. Examples: WP Engine, Kinsta, Flywheel. Best for business sites.
VPS (Virtual Private Server) ($10-50/month): Dedicated resources, better performance, more control. Examples: DigitalOcean, Linode, Vultr. Requires technical knowledge.
After purchasing hosting: 1. Record hosting credentials (cPanel login, FTP details, database info) 2. Set up email accounts if needed 3. Configure DNS (may take 24-48 hours to propagate)
Creating a Backup of Your Local WordPress Site
Always backup before migration:
Database Export: 1. Open localhost site in browser 2. Access phpMyAdmin (usually http://localhost/phpmyadmin/) 3. Select your WordPress database from left sidebar 4. Click “Export” tab 5. Choose “Quick” export method 6. Click “Go” to download .sql file 7. Save as localhost-backup.sql
File Backup: 1. Navigate to your local WordPress installation folder – XAMPP: C:
– MAMP: /Applications/MAMP/htdocs/sitename/ – Local by Flywheel: ~/Local Sites/sitename/app/public/ 2. Copy entire WordPress folder to safe location 3. Zip the folder for easier transfer
You now have complete local site backup for safe migration.
Exporting and Preparing the Database
The database export needs URL replacement:
Find and Replace URLs:
Your localhost database contains URLs like: – http://localhost/sitename/ – http://localhost:8888/sitename/ – http://sitename.local/
These must become: – https://yourdomain.com/
Method 1: Search-Replace-DB Script (Recommended) 1. Download Search-Replace-DB from https://github.com/interconnectit/Search-Replace-DB 2. Extract to your local WordPress root 3. Open http://localhost/sitename/Search-Replace-DB/ in browser 4. Enter old URL: http://localhost/sitename 5. Enter new URL: https://yourdomain.com 6. Click “Dry run” to preview changes 7. Click “Live run” to execute replacement 8. Export database after replacement
Method 2: WP-CLI (Advanced)
wp search-replace 'http://localhost/sitename' 'https://yourdomain.com' --export=export.sqlMethod 3: Manual SQL (Not Recommended – Breaks Serialized Data) Only use if above methods aren’t available. Open .sql file and replace URLs, being careful with serialized data.
After replacement, you have a database ready for live server.
Creating Database on Live Server
Access your hosting control panel (cPanel):
Creating MySQL Database: 1. Log into cPanel 2. Navigate to “MySQL Databases” icon 3. Create new database: – Database name: username_wordpress (cPanel prefixes with username) – Click “Create Database” 4. Create database user: – Username: username_wpuser – Password: Generate strong password (save it!) – Click “Create User” 5. Add user to database: – Select database: username_wordpress – Select user: username_wpuser – Grant ALL PRIVILEGES – Click “Add”
Record these credentials: – Database name: username_wordpress – Database user: username_wpuser – Database password: [your password] – Database host: localhost (usually)
Importing Database to Live Server
Upload your prepared database:
Via phpMyAdmin (Easiest): 1. Open cPanel phpMyAdmin 2. Select your database (username_wordpress) from left sidebar 3. Click “Import” tab 4. Choose file: Select your modified .sql file 5. Scroll to bottom, click “Go” 6. Wait for import to complete 7. Verify: Check if wp_posts, wp_options tables appear
Via Command Line (Faster for Large Databases):
mysql -u username_wpuser -p username_wordpress < export.sqlImport Errors? – “Maximum execution time exceeded”: Increase max_execution_time in php.ini – File too large: Split .sql file or use BigDump tool – “Unknown collation”: Check database collation matches (usually utf8mb4_unicode_ci)
Transferring WordPress Files via FTP/SFTP
Upload your WordPress files to the live server:
FTP Client Setup: 1. Download FileZilla (https://filezilla-project.org/) 2. Open FileZilla 3. Enter credentials: – Host: ftp.yourdomain.com (or hosting IP) – Username: [from hosting provider] – Password: [from hosting provider] – Port: 21 (FTP) or 22 (SFTP – more secure) 4. Click “Quickconnect”
Upload Process: 1. Local Site (left pane): Navigate to your local WordPress folder 2. Remote Site (right pane): Navigate to public_html/ or www/ directory 3. Select all WordPress files (don’t include the parent folder) 4. Right-click → Upload 5. Wait for transfer (may take 10-60 minutes depending on site size)
Important: Upload the contents of your WordPress folder, not the folder itself. Your live server should show:
public_html/
├── wp-admin/
├── wp-content/
├── wp-includes/
├── wp-config.php
├── index.php
└── ...
Not:
public_html/
└── sitename/
├── wp-admin/
└── ...
Updating wp-config.php
Configure WordPress to connect to your live database:
Access wp-config.php: 1. In FileZilla, locate wp-config.php in public_html/ 2. Right-click → View/Edit 3. Opens in your text editor
Update Database Credentials: Find these lines and update:
define( 'DB_NAME', 'username_wordpress' ); // Your new database name
define( 'DB_USER', 'username_wpuser' ); // Your new database user
define( 'DB_PASSWORD', 'your_password_here' ); // Your new database password
define( 'DB_HOST', 'localhost' ); // Usually 'localhost'Update Authentication Keys (Important for Security): Replace authentication keys and salts. Visit https://api.wordpress.org/secret-key/1.1/salt/ to generate new keys.
Replace this section:
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');Save and Upload: 1. Save file in text editor 2. FileZilla prompts to upload changed file 3. Click “Yes” to upload
Setting Correct File Permissions
Proper permissions ensure security and functionality:
Recommended Permissions: – Directories: 755 – Files: 644 – wp-config.php: 600 (extra secure)
Setting Permissions in FileZilla: 1. Right-click on public_html/ → File permissions 2. Set numeric value: 755 3. Check “Recurse into subdirectories” 4. Select “Apply to directories only” 5. Click OK
Repeat for files: 1. Right-click on public_html/ → File permissions 2. Set numeric value: 644 3. Check “Recurse into subdirectories” 4. Select “Apply to files only” 5. Click OK
Special case for wp-config.php: 1. Right-click wp-config.php → File permissions 2. Set numeric value: 600 3. Click OK
Configuring DNS and Domain Settings
Point your domain to your hosting server:
DNS Configuration: 1. Log into your domain registrar (GoDaddy, Namecheap, etc.) 2. Find DNS settings or nameserver settings 3. Update nameservers to those provided by your host: – Example: ns1.hostingprovider.com, ns2.hostingprovider.com 4. Save changes
Propagation: DNS changes take 24-48 hours to propagate worldwide. During this time, some visitors see the old site, some see the new site.
Testing Before Propagation: Use hosts file to preview: – Windows: C: – Mac/Linux: /etc/hosts
Add line:
123.456.789.123 yourdomain.com
(Replace with your server IP)
This lets YOU see the live site immediately while DNS propagates.
Installing SSL Certificate (HTTPS)
Modern sites require HTTPS:
Free SSL with Let’s Encrypt (Most Hosts): 1. Log into cPanel 2. Find “SSL/TLS Status” or “Let’s Encrypt” 3. Select your domain 4. Click “Install” or “Enable SSL” 5. Wait 2-5 minutes for installation 6. Verify: Visit https://yourdomain.com
Enforce HTTPS (Redirect HTTP to HTTPS): Add to .htaccess:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]Update WordPress URLs: 1. Log into WordPress admin 2. Settings → General 3. WordPress Address (URL): https://yourdomain.com 4. Site Address (URL): https://yourdomain.com 5. Save Changes
Testing Your Live Site
Thoroughly test everything:
Functional Testing: – [ ] Homepage loads correctly – [ ] All pages accessible – [ ] Navigation menus work – [ ] Search functionality works – [ ] Contact forms submit successfully – [ ] Images display properly – [ ] Comments work (if enabled) – [ ] User registration works (if enabled) – [ ] E-commerce checkout processes orders (if applicable)
Technical Testing: – [ ] HTTPS works (green padlock in browser) – [ ] No mixed content warnings – [ ] Permalinks work correctly – [ ] Admin area accessible – [ ] Plugins function properly – [ ] Theme displays correctly – [ ] Mobile responsive design works
Cross-Browser Testing: Test on Chrome, Firefox, Safari, Edge to ensure compatibility.
Performance Testing: Use tools like GTmetrix or PageSpeed Insights to check load times.
Common Migration Errors and Solutions
Error: “Error Establishing Database Connection” – Cause: Incorrect wp-config.php database credentials – Solution: Double-check database name, username, password in wp-config.php
White Screen of Death – Cause: PHP errors, memory limit, plugin conflicts – Solution: Enable WP_DEBUG in wp-config.php, check error logs, deactivate plugins
Broken Images / Missing CSS – Cause: URLs still pointing to localhost – Solution: Re-run search-replace on database for any remaining localhost references
404 Errors on All Pages Except Homepage – Cause: .htaccess permalink rules not working – Solution: Settings → Permalinks → Save Settings (regenerates .htaccess)
“The Link You Followed Has Expired” (Upload Errors) – Cause: PHP upload limits too low – Solution: Increase upload_max_filesize and post_max_size in php.ini
Post-Launch SEO and Performance
Submit to Search Engines: 1. Google Search Console: Submit sitemap 2. Bing Webmaster Tools: Submit sitemap 3. Set up Google Analytics
Performance Optimization: – Install caching plugin (WP Super Cache, W3 Total Cache) – Enable Gzip compression – Optimize images (Smush, ShortPixel) – Use CDN for static assets (Cloudflare)
Monitoring: – Set up uptime monitoring (UptimeRobot) – Enable backup schedule – Monitor site speed weekly
Conclusion
Migrating WordPress from localhost to live server involves several steps, but following this guide systematically ensures a smooth launch. The keys are:
- Prepare thoroughly with backups
- Handle URL replacement carefully
- Configure database credentials correctly
- Set proper file permissions
- Test comprehensively before announcing
Your local development site is now live, accessible to the world. Congratulations on your launch!
External Links
- Installing WordPress Locally – XAMPP
- Installing WordPress Locally – MAMP
- FileZilla FTP Tutorial
- Changing Database Connection
- DNS Propagation Checker
Call to Action
Launch your site with confidence! Backup Copilot Pro helps you create localhost backups, handle find-replace automatically, and rollback if needed. Perfect for developers—try it free today!

