WordPress Migration Guide: How to Move Your WordPress Site to New Hosting

WordPress Site Migration Complete Guide

Migrating a WordPress website to new hosting can feel overwhelming, but when done methodically using cPanel, it’s a straightforward process.

This guide walks you through the exact steps we used to successfully migrate a WordPress site, highlighting common pitfalls and their solutions based on real experience.


Part 1: Preparation – Before You Begin

Understanding Your Current Setup

Before starting any migration, you need to understand what you’re working with:

What you should know:

  1. Hosting type: Is it cPanel, Plesk, or custom panel?
  2. Backup type: Full cPanel backup or just website files?
  3. Database details: One database or multiple?
  4. Special configurations: Multisite, custom plugins, unique file structures

Our case example: We had an expired hosting account with only a backup file, which contained multiple WordPress installations we needed to identify.

The Essential Pre-Migration Checklist

## Pre-Migration Checklist
- [ ] Verified backup file integrity
- [ ] Documented current site URL structure
- [ ] Noted any custom configurations
- [ ] Scheduled migration during low-traffic hours
- [ ] Informed stakeholders of potential downtime
- [ ] Created rollback plan

Part 2: The Standard Migration Process

Step 1: Creating the Correct Site Structure in New Hosting

Standard Procedure:

  1. Log into new hosting cPanel
  2. Navigate to Domains → Addon Domains
  3. Enter your domain name (e.g., yourwebsite.com)
  4. Accept the default document root (usually /home/username/yourwebsite.com/)

What typically works: For 90% of migrations, the default document root is correct.

Our experience: Our backup had a unique structure with files in homedir/public_html/. We had to manually set the document root to:

/home/username/yourwebsite.com/homedir/public_html/

Lesson learned: Always check your backup structure before setting up the addon domain.

Step 2: Uploading Your Website Files

The Right Way:

  1. Use cPanel File Manager or FTP
  2. Navigate to your document root
  3. Upload all WordPress files:
  • wp-admin/
  • wp-content/ (most important – contains themes, plugins, uploads)
  • wp-includes/
  • wp-config.php
  • index.php
  • .htaccess

Common mistake: Uploading the entire backup archive instead of extracting first.

Our solution: We extracted the backup locally first, identified the correct WordPress files, then uploaded them individually via File Manager.

Step 3: Setting Up the Database

Standard Database Setup:

# In cPanel MySQL Databases:
1. Create new database: username_sitename
2. Create new user: username_sitenameuser
3. Add user to database with ALL privileges
4. Generate and save strong password

Our complication: We had multiple database files in the backup. We needed to:

  1. Identify which database the site actually used
  2. Check wp-config.php for database name clues
  3. Import the correct .sql file

Step 4: Importing the Database

Standard Import Process:

  1. cPanel → phpMyAdmin
  2. Select your new database
  3. Click Import
  4. Choose your .sql file
  5. Click Go

Common issues:

  • File too large: Use cPanel’s MySQL Database Restore tool instead
  • Import errors: Clean the SQL file of old user permissions

Our specific issue: The SQL file contained GRANT statements for old users, causing import failures. We removed these lines before importing.

Step 5: Updating wp-config.php

Standard Configuration:

// Standard updates needed
define('DB_NAME', 'your_new_database_name');
define('DB_USER', 'your_new_database_user');
define('DB_PASSWORD', 'your_strong_password');
define('DB_HOST', 'localhost');

// Optional: If migrating to HTTPS
define('WP_HOME', 'https://yourdomain.com');
define('WP_SITEURL', 'https://yourdomain.com');

Our additional step: We had to verify and preserve the table prefix from the original site:

// Found in original wp-config.php
$table_prefix = 'nLy73tm6y_'; // Had to keep this exact prefix

Part 3: Testing Before Going Live

The Hosts File Method – Your Safety Net

Why use hosts file testing?

  • Test migration without DNS changes
  • Verify everything works before going live
  • Fix issues without affecting live site

Step-by-Step Hosts File Setup:

Windows:

  1. Open Notepad as Administrator
  2. Open C:\Windows\System32\drivers\etc\hosts
  3. Add: [YOUR_NEW_SERVER_IP] yourdomain.com www.yourdomain.com
  4. Save

macOS/Linux:

sudo nano /etc/hosts
# Add the same line
sudo dscacheutil -flushcache  # macOS
sudo systemd-resolve --flush-caches  # Linux

Our experience: This method revealed that our migration was successful but WordPress was redirecting to HTTPS, which was normal behavior.

Comprehensive Testing Checklist

## Migration Testing Checklist
### Basic Functionality
- [ ] Homepage loads completely
- [ ] No PHP/MySQL errors displayed
- [ ] WordPress admin accessible (/wp-admin/)
- [ ] Can login with existing credentials

### Content Verification
- [ ] All pages/posts display correctly
- [ ] Images and media load properly
- [ ] Navigation menus work
- [ ] Search functionality works

### Form & Interactive Elements
- [ ] Contact forms submit successfully
- [ ] Comments can be posted (if applicable)
- [ ] E-commerce functions work (cart, checkout)

### Technical Checks
- [ ] No mixed content warnings (HTTP/HTTPS)
- [ ] SSL certificate working (if applicable)
- [ ] No broken links in console
- [ ] Mobile responsive design intact

Part 4: Common Problems & Solutions

Problem 1: “Index of /” Page Instead of WordPress

Symptoms: You see a directory listing instead of your website.

Causes:

  1. Files in wrong location
  2. Missing index.php
  3. Incorrect .htaccess

Solutions:

# 1. Check file location
# Should be in: /home/username/domain.com/public_html/

# 2. Verify index.php exists
ls -la /home/username/domain.com/public_html/index.php

# 3. Create .htaccess if missing
# Add basic WordPress rules:
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Problem 2: Database Connection Error

Symptoms: “Error establishing a database connection”

Solutions:

  1. Verify credentials in wp-config.php
  2. Check database exists in cPanel
  3. Test connection with simple PHP script:
<?php
$conn = mysqli_connect('localhost', 'username', 'password', 'database');
echo $conn ? "Connected" : "Failed: " . mysqli_connect_error();
?>

Problem 3: 404 Errors on Pages

Solution:

  1. Login to WordPress admin
  2. Go to Settings → Permalinks
  3. Click “Save Changes” (regenerates .htaccess)

Problem 4: Images Not Loading

Cause: Hardcoded URLs in database pointing to old server.

Solution: Update URLs in database:

UPDATE wp_posts 
SET post_content = REPLACE(post_content, 
    'http://olddomain.com', 
    'https://newdomain.com');

Part 5: Going Live with DNS Update

Cloudflare DNS Configuration (Recommended)

Optimal Settings:

A Record:
- Name: @
- Content: [YOUR_NEW_SERVER_IP]
- Proxy status: Proxied (orange cloud) ✅
- TTL: 5 minutes (temporarily)

CNAME Record:
- Name: www
- Content: yourdomain.com
- Proxy status: Proxied ✅
- TTL: 5 minutes

SSL/TLS Settings:

  • Encryption mode: Full (strict)
  • Always use HTTPS: On
  • Automatic HTTPS Rewrites: On

Our experience: The proxy (orange cloud) is crucial for hiding your server IP and providing free SSL.

DNS Propagation Timeline

## Expected Propagation Times
- **5-30 minutes:** Most users will see new site
- **1-4 hours:** Global propagation typically completes
- **24-48 hours:** Full propagation (rare cases)

## Monitoring Tools
- whatsmydns.net
- dig web interface
- Cloudflare propagation status

Post-DNS Change Verification

Immediate checks (first 15 minutes):

  1. Can you access the site via domain?
  2. Is SSL certificate working?
  3. Are there any immediate errors?

First hour checks:

  1. Test from different network (mobile data)
  2. Verify all functionality still works
  3. Check email delivery (if hosting email)

Part 6: Post-Migration Optimization

Essential Post-Migration Tasks

Within 24 hours:

  1. Update plugins/themes: After confirming stability
  2. Configure backups: Set up regular backups on new host
  3. Performance optimization: Implement caching if not present
  4. Security hardening: Install security plugin, limit login attempts

Within 1 week:

  1. Monitor Google Search Console for crawl errors
  2. Check analytics for traffic anomalies
  3. Test all forms and interactive elements
  4. Update sitemap and submit to search engines

Creating a Migration Runbook

Document your migration for future reference:

# Migration Runbook: [Website Name]

## Basic Information
- **Date:** [Migration Date]
- **From:** [Old Hosting Provider]
- **To:** [New Hosting Provider]
- **Lead:** [Your Name]

## Technical Details
### Pre-Migration
- Backup type: [Full cPanel backup/Manual files+DB]
- Backup size: [Files: X GB, Database: Y MB]
- Special considerations: [Multisite, custom plugins, etc.]

### Migration Steps Taken
1. [Step 1 with timing]
2. [Step 2 with timing]
3. [Step 3 with timing]

### Issues Encountered
1. [Issue description and solution]
2. [Issue description and solution]

### Post-Migration Verification
- [ ] All pages functional
- [ ] Forms working
- [ ] No broken links
- [ ] Performance comparable/better

## Contact Information
- New hosting support: [Contact details]
- Domain registrar: [Contact details]
- Team members involved: [Names/roles]

Part 7: Advanced Scenarios

Migrating Multiple Sites from One Backup

Our situation: The backup contained three WordPress installations.

Strategy:

  1. Identify which site corresponds to which domain
  2. Check each wp-config.php for database names
  3. Create separate addon domains for each site
  4. Import respective databases

Identification method:

# Look for clues in wp-config.php
grep -r "DB_NAME" backup_folder/
grep -r "siteurl" database_dump.sql

Migrating Without wp-admin Access

If you can’t access old WordPress admin:

Alternative URL update methods:

  1. Direct database update:
UPDATE wp_options 
SET option_value = 'https://newdomain.com' 
WHERE option_name IN ('siteurl', 'home');
  1. Search and replace script: Use interconnectIT’s Search Replace DB script (temporary, remove after use)
  2. WP-CLI (if available on new host):
wp search-replace 'http://olddomain.com' 'https://newdomain.com' --all-tables

Part 8: Troubleshooting Guide

Quick Reference: Symptoms and Solutions

SymptomLikely CauseImmediate Action
White screenPHP errorEnable debug mode in wp-config.php
500 Internal Error.htaccess or permissionsCheck error log, fix permissions
Mixed contentHTTP resources on HTTPS siteUpdate database URLs, use plugin
Slow loadingNo caching, large imagesImplement caching, optimize images
Login redirect loopCookie domain issueClear cookies, check wp-config.php

Essential Diagnostic Commands

# Check PHP version
php -v

# Check MySQL connection
mysql -u username -p -e "SELECT 1"

# Check file permissions
ls -la /path/to/wordpress/

# Check error logs (cPanel)
cat /home/username/logs/error_log | tail -50

# Test WordPress via WP-CLI
wp core check-update
wp plugin list
wp theme list

Conclusion: Migration Success Principles

The 5 Golden Rules of WordPress Migration

  1. Test before cutover: Always use hosts file method
  2. Document everything: Create runbook for future reference
  3. Have rollback plan: Know how to revert if needed
  4. Communicate clearly: Keep stakeholders informed
  5. Monitor post-migration: Watch for issues in first 72 hours

Success Metrics

Your migration is successful when:

  • ✅ Site loads without errors
  • ✅ All functionality works
  • ✅ Performance is equal or better
  • ✅ SEO ranking maintained
  • ✅ Users experience no disruption

Continuous Improvement

After each migration:

  1. Update your migration checklist
  2. Note what went well and what didn’t
  3. Refine your process for next time
  4. Share learnings with team

Appendix: Quick-Start Migration Template

One-Page Migration Plan

# WordPress Migration Plan

## Pre-Migration (Day Before)
- [ ] Backup verified
- [ ] DNS TTL reduced to 300
- [ ] Stakeholders notified
- [ ] Maintenance window scheduled

## Migration Day
### Phase 1: Setup (30 mins)
- [ ] Create addon domain
- [ ] Upload files to correct location
- [ ] Set file permissions (755/644)

### Phase 2: Database (20 mins)
- [ ] Create new database/user
- [ ] Import SQL file
- [ ] Update wp-config.php

### Phase 3: Testing (45 mins)
- [ ] Edit hosts file
- [ ] Test all functionality
- [ ] Fix any issues found

### Phase 4: Go Live (15 mins)
- [ ] Update DNS records
- [ ] Enable Cloudflare proxy
- [ ] Set SSL to Full (strict)

## Post-Migration (24-48 hours)
- [ ] Monitor site performance
- [ ] Verify all forms work
- [ ] Check for broken links
- [ ] Update migration documentation

Final Thoughts

WordPress migration via cPanel is a skill that improves with practice. While our specific migration had unique challenges (expired hosting, multiple WordPress installs, unique file structure), the fundamental process remains the same:

  1. Prepare thoroughly
  2. Execute methodically
  3. Test comprehensively
  4. Verify post-migration

Remember: Every migration teaches you something new. Document your experiences, build your toolkit of scripts and checklists, and soon you’ll be migrating WordPress sites with confidence and efficiency.

Happy migrating! 🚀

Based on real-world migration experience with detailed troubleshooting documentation.

Unlock Growth Secrets!

Get actionable insights on SEO, content strategy, email marketing, and more—straight to your inbox.

We don’t spam! Read our privacy policy for more info.

Leave a Reply

Your email address will not be published. Required fields are marked *

Text copied to clipboard with attribution!