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:
- Hosting type: Is it cPanel, Plesk, or custom panel?
- Backup type: Full cPanel backup or just website files?
- Database details: One database or multiple?
- 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:
- Log into new hosting cPanel
- Navigate to Domains → Addon Domains
- Enter your domain name (e.g.,
yourwebsite.com) - 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:
- Use cPanel File Manager or FTP
- Navigate to your document root
- Upload all WordPress files:
wp-admin/wp-content/(most important – contains themes, plugins, uploads)wp-includes/wp-config.phpindex.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:
- Identify which database the site actually used
- Check
wp-config.phpfor database name clues - Import the correct
.sqlfile
Step 4: Importing the Database
Standard Import Process:
- cPanel → phpMyAdmin
- Select your new database
- Click Import
- Choose your
.sqlfile - 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:
- Open Notepad as Administrator
- Open
C:\Windows\System32\drivers\etc\hosts - Add:
[YOUR_NEW_SERVER_IP] yourdomain.com www.yourdomain.com - 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:
- Files in wrong location
- Missing
index.php - 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:
- Verify credentials in
wp-config.php - Check database exists in cPanel
- 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:
- Login to WordPress admin
- Go to Settings → Permalinks
- 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):
- Can you access the site via domain?
- Is SSL certificate working?
- Are there any immediate errors?
First hour checks:
- Test from different network (mobile data)
- Verify all functionality still works
- Check email delivery (if hosting email)
Part 6: Post-Migration Optimization
Essential Post-Migration Tasks
Within 24 hours:
- Update plugins/themes: After confirming stability
- Configure backups: Set up regular backups on new host
- Performance optimization: Implement caching if not present
- Security hardening: Install security plugin, limit login attempts
Within 1 week:
- Monitor Google Search Console for crawl errors
- Check analytics for traffic anomalies
- Test all forms and interactive elements
- 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:
- Identify which site corresponds to which domain
- Check each
wp-config.phpfor database names - Create separate addon domains for each site
- 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:
- Direct database update:
UPDATE wp_options
SET option_value = 'https://newdomain.com'
WHERE option_name IN ('siteurl', 'home');
- Search and replace script: Use interconnectIT’s Search Replace DB script (temporary, remove after use)
- 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
| Symptom | Likely Cause | Immediate Action |
|---|---|---|
| White screen | PHP error | Enable debug mode in wp-config.php |
| 500 Internal Error | .htaccess or permissions | Check error log, fix permissions |
| Mixed content | HTTP resources on HTTPS site | Update database URLs, use plugin |
| Slow loading | No caching, large images | Implement caching, optimize images |
| Login redirect loop | Cookie domain issue | Clear 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
- Test before cutover: Always use hosts file method
- Document everything: Create runbook for future reference
- Have rollback plan: Know how to revert if needed
- Communicate clearly: Keep stakeholders informed
- 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:
- Update your migration checklist
- Note what went well and what didn’t
- Refine your process for next time
- 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:
- Prepare thoroughly
- Execute methodically
- Test comprehensively
- 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.

Leave a Reply