Insights:PHP Website Migration: Boundaries Between Changing Servers and Frameworks
Type 1: Switch Server (Same Tech Stack Migration)
Goal: Keep the code unchanged, move to a different server.
Checklist:
- Ensure PHP version and extensions match (version differences can cause function behavior changes).
- Verify database version and character set are consistent.
- Recreate file paths, permissions, and scheduled tasks.
- Switch domain DNS resolution, SSL certificate, and email sending configuration.
- Fully copy cache directories and upload directories.
Risks: Missing extensions causing blank pages, timezone mismatches causing time errors, upload directory permission issues resulting in 404 images.
Switching Method:
- Deploy on new server + import database.
- Run through core workflows using a test domain.
- Compare key page content and status codes between old and new sites.
- Switch DNS; keep the old server available for rollback within 24–48 hours.
Type 2: Switch Framework (Structural Rewrite)
Goal: Upgrade or replace the tech stack; page structure may change.
Prerequisites:
- Can existing code still be maintained (do people know it? Are dependencies upgradable?).
- Is there documentation for business logic (high risk of rewrite without documentation).
- Is there a timeline window for parallel dual-operation?
Execution Order:
- List all routes and pages; build an old-to-new URL mapping table.
- Migrate the data layer first, ensuring consistent field semantics.
- Migrate module by module; validate each against the old site after completion.
- Set up 301 redirects for all old URLs to new ones — no 404s.
- Canary release; monitor error logs and key pages.
Risk Points: URL structure changes causing indexing loss, template differences causing content misalignment, and different permission models causing admin panel unavailability.
Comparison of Two Migration Types
| Dimension | Server Change | Framework Change |
|---|---|---|
| Code Changes | None | Significant |
| Timeline | 1–3 Days | Several Weeks to Months |
| Rollback Method | Switch Back to Old Server | Keep Old Site Running in Parallel |
| Main Risks | Environment Inconsistency | URL and Logic Loss |
| Acceptance Focus | Page Consistency, Functionality Available | Content Consistency, Links Reachable |
Three Must-Dos Before Migration
- Full Backup: Code + database + uploaded files, with verified restore capability.
- Record Baseline: Capture status codes and titles for core pages before migration.
- Prepare Rollback: Keep the old environment active for at least one week with DNS switchback capability.
Five Must-Checks After Migration
- Core pages return 200 with correct titles.
- Images and attachments are accessible.
- Forms submit successfully and emails are received.
- Admin panel is loggable and publishable.
- Old URLs have 301 redirects; no mass 404 errors.
Boundaries
Migration addresses "environment and structure," not content or rankings. If a framework change alters the URL structure, short-term traffic fluctuations are normal, but they should be cushioned by 301 redirects and an updated sitemap.
Related Reading: