Content Migration
Update existing database content to use CDN URLs
Understanding Content Migration
Two Approaches to CDN
The plugin offers two ways to serve content via CDN:
1. Dynamic Replacement (Default - Recommended)
- URLs are replaced on-the-fly as pages load
- Original URLs stay in the database
- No database changes needed
- Safe and reversible
- ✅ This is what the plugin does by default
2. Database Migration (Optional)
- URLs are permanently changed in the database
- Hardcoded CDN URLs in posts, pages, and media
- Slightly faster (no replacement overhead)
- ⚠️ Harder to reverse if you change CDN providers
When to Use Migration
Good Reasons to Migrate
- Switching CDN Providers: Moving from one CDN to another
- Migrating from Another Plugin: Had a different CDN plugin that hardcoded URLs
- Performance Optimization: Want absolute maximum performance (marginal gain)
- Exporting Content: Need content with CDN URLs for external use
Bad Reasons to Migrate
- ❌ "Just in case" - Don't do it unless you have a specific need
- ❌ Thinking it will be faster - Dynamic replacement is already very fast
- ❌ Following a tutorial from 2015 - Modern plugins don't need this
Before You Migrate
⚠️ Critical Backup Step
BACKUP YOUR DATABASE FIRST!
Migration permanently changes your database. Always create a full database backup before proceeding.
Backup Methods
- Via Hosting Control Panel: Most hosts offer phpMyAdmin backup
- Via Plugin: Use UpdraftPlus, BackupBuddy, or similar
- Via WP-CLI:
wp db export backup.sql
Pre-Migration Checklist
- ✅ Full database backup created
- ✅ All CDN URLs configured and tested
- ✅ CDN connection test passed (Tools page)
- ✅ Site is working correctly with dynamic replacement
- ✅ Have FTP/SSH access in case of issues
How to Migrate Content
Access Migration Page
Go to 1 CDN Manager → Migration
Migration Options
1. Migrate Images
What it does: Replaces image URLs in posts, pages, and custom post types
Affects:
- Post content (
post_content) - Image URLs in
<img>tags - Featured images
- Gallery images
Example:
Before: https://example.com/wp-content/uploads/image.jpg
After: https://img-cdn.example.com/wp-content/uploads/image.jpg
2. Migrate Media Files
What it does: Replaces video and audio URLs
Affects:
- Video URLs in
<video>tags - Audio URLs in
<audio>tags - WordPress media library URLs
Example:
Before: https://example.com/wp-content/uploads/video.mp4
After: https://media-cdn.example.com/wp-content/uploads/video.mp4
3. Migrate Static Assets
What it does: Replaces CSS and JavaScript URLs
Affects:
- Hardcoded
<link>tags - Hardcoded
<script>tags - Inline CSS references
Example:
Before: https://example.com/wp-content/themes/mytheme/style.css
After: https://static-cdn.example.com/wp-content/themes/mytheme/style.css
4. Migrate All Content
What it does: Runs all migrations above in one go
Recommended: Use individual migrations first to test
Running Migration
- Choose migration type (Images, Media, Static, or All)
- Click the "Preview Changes" button (optional but recommended)
- Review what will be changed
- Click "Run Migration" button
- Wait for completion message
- Check your site to verify everything works
Migration Progress
During migration, you'll see:
- Number of posts/pages being processed
- Number of URLs replaced
- Estimated time remaining
- Any errors encountered
After Migration
Verification Steps
- Visit Homepage: Check that everything loads correctly
- Check Multiple Pages: Test posts, pages, archives
- View Page Source: Right-click → View Source → Search for CDN URLs
- Test Media: Verify images, videos load from CDN
- Check Admin: Verify media library works
If Something Goes Wrong
Immediate Rollback:
- Restore your database backup
- Or use the "Rollback Migration" button on Migration page
Rollback Process
The plugin keeps track of migrations. To rollback:
- Go to 1 CDN Manager → Migration
- Click "View Migration History"
- Click "Rollback" next to the migration you want to undo
- Wait for completion
Advanced Migration Options
Selective Migration
Migrate only specific post types:
- Expand "Advanced Options" section
- Select post types: Posts, Pages, Products, etc.
- Choose date range (optional)
- Run migration
Dry Run Mode
Test migration without making changes:
- Enable "Dry Run" checkbox
- Run migration
- Review what WOULD be changed
- Run actual migration once satisfied
Custom Search/Replace
For advanced users with specific needs:
- Go to "Custom Migration" tab
- Enter custom search pattern
- Enter replacement pattern
- Select tables to search
- Run custom migration
Special Cases
WooCommerce Products
Product images are handled automatically. Migration includes:
- Product featured images
- Product gallery images
- Product descriptions with images
Page Builders
Elementor, Divi, Beaver Builder
- Migration searches page builder metadata
- Updates serialized data safely
- Preserves page builder structure
Multilingual Sites (WPML, Polylang)
- Migration processes all language versions
- Each translation is updated independently
Multisite Networks
For WordPress Multisite:
- Migration can run per-site or network-wide
- Network admin can migrate all sites at once
- Each site can also migrate independently
Migration Best Practices
DO's
- ✅ Always backup before migration
- ✅ Test on staging site first
- ✅ Run migrations during low-traffic periods
- ✅ Use preview mode first
- ✅ Migrate in small batches (Images first, then Media, then Static)
- ✅ Verify each batch before proceeding
DON'Ts
- ❌ Don't migrate on production without testing
- ❌ Don't skip the backup step
- ❌ Don't close browser during migration
- ❌ Don't run multiple migrations simultaneously
- ❌ Don't migrate if CDN is not working
Performance Considerations
- Large Sites: Migration may take 10-30 minutes for sites with 10,000+ posts
- Shared Hosting: May need to increase PHP timeout limits
- Database Size: Backup and migration time scales with database size
Troubleshooting Migration
Migration Timed Out
Solution: Increase PHP timeout
Add to wp-config.php:
set_time_limit(300); // 5 minutes
ini_set('max_execution_time', 300);
Some URLs Not Migrated
Possible causes:
- URLs in custom fields (use Custom Migration)
- URLs in serialized data
- URLs in custom post types not included
Rollback Not Working
Solution: Restore from database backup
This is why backups are critical!