[[INSTRUCTION: ]] # The Manual Migration Guide: Moving WordPress Files and the Database The Manual Migration Guide: Moving WordPress Files and the Database Key Takeaways for a Seamless Manual WordPress Migration **Unparalleled Control & Understanding:** Manual migration grants you granular control, enabling a deeper understanding of your WordPress system and precise troubleshooting. **The Cornerstone: Comprehensive Backups:** Never, under any circumstances, proceed without a complete and verified backup of both your WordPress files and database. This is your safety net. **Two Core Phases:** The migration process fundamentally separates into distinct steps: transferring your entire WordPress file system and relocating/updating your database. **Precision in Configuration:** Meticulous attention to detail in editing `wp-config.php` and accurately updating database URLs post-import is paramount to prevent critical post-migration issues. **Rigorous Post-Migration Testing:** Thoroughly testing all functionalities is non-negotiable. Ensure your site performs optimally, all links work, and every feature is intact in its new environment. As seasoned experts at DebugPress.com, we understand that moving a WordPress website can feel like a daunting task. While automated plugins offer a quick fix, they often obscure the underlying mechanics, leaving you vulnerable to obscure errors and a lack of control. This comprehensive guide champions the **manual WordPress migration** – a method that, while requiring precision, rewards you with unparalleled insight, robust troubleshooting capabilities, and a deep understanding of your site’s architecture. For intermediate to advanced WordPress professionals, developers, and power users, mastering manual migration is not just a skill; it’s a strategic imperative. This definitive article will walk you through every critical step, from strategic planning and meticulous backups to the precise transfer of files and database, culminating in a rigorous post-migration checklist. Our goal is to equip you with the knowledge and confidence to execute a flawless migration, ensuring your WordPress site thrives in its new home. 1. The Strategic Imperative: Why Manual Migration? In the vast landscape of WordPress management, migration is a frequent necessity. Whether you’re upgrading hosting, moving to a staging environment, or simply reorganizing your web assets, the question of *how* to move your site is paramount. While numerous plugins promise one-click solutions, we at DebugPress.com advocate for the **manual approach** in specific scenarios, not as a challenge, but as a commitment to mastery and control. Understanding the “Why”: Beyond Automated Tools Automated migration tools are convenient, but they operate as black boxes. They abstract away the complex steps, which can be beneficial for beginners. However, this abstraction comes at a cost: a lack of understanding of what’s truly happening. When issues arise with an automated migration, diagnosing the problem can be akin to searching for a needle in a haystack you didn’t even know you owned. Manual migration, conversely, forces you to engage with every component of your WordPress installation – the database, the file system, and the critical configuration files – fostering a profound understanding of your site’s architecture. Advantages of the Manual Approach: Precision and Independence **Precision Troubleshooting:** Because you’ve manually touched every piece of the migration, you inherently understand its state. This allows for incredibly precise troubleshooting when minor glitches occur, leading to faster resolutions and less downtime. You know exactly where to look when a problem surfaces. **Independence from Plugin Limitations:** Relying on third-party plugins introduces dependencies. A plugin might not support your specific server environment, could have bugs, or might even be abandoned, leaving you stranded. Manual migration frees you from these constraints, giving you universal applicability across virtually any server setup. **Suitability for Complex Environments:** For developers managing sites with custom configurations, intricate server setups (e.g., specific Nginx rules, load balancers, or unique directory structures), or highly optimized performance stacks, automated tools often fall short. Manual migration allows you to tailor every aspect of the transfer to these complex requirements. **Cost-Effectiveness for Small to Medium Sites:** While time is money, for sites that don’t stretch into multi-gigabyte databases or tens of thousands of files, manual migration can be significantly more cost-effective than investing in premium migration plugins or specialized hosting services, especially if you possess the technical acumen. **Enhanced Security Control:** During a manual migration, you’re directly handling sensitive data and connection credentials. This gives you a direct opportunity to review and update security measures, such as generating new database salts or checking file permissions, without relying on a plugin’s potentially opaque security practices. When to Choose Manual: Ideal Scenarios Manual migration isn’t for everyone, but it’s the optimal choice for a specific subset of WordPress users and scenarios: **Developers & Power Users:** If you’re comfortable with server environments, command lines, or tools like phpMyAdmin and FTP clients, manual migration is a natural extension of your skillset. **Learning & Skill Development:** For those looking to deepen their understanding of WordPress internals and server management, manual migration is an invaluable learning experience. **Specific Configuration Needs:** Any scenario where a generic automated transfer simply won’t suffice due to unique server configurations, bespoke WordPress setups, or stringent security policies. **Performance Tuning Opportunities:** Manual migration allows for a clean slate, offering the chance to optimize database tables, review file structures, and implement performance enhancements directly during the transfer. Potential Challenges: Time, Learning Curve, and Risk It’s crucial to acknowledge the downsides: **Time-Consuming:** Manual migration undeniably takes more time than a click-and-wait solution, particularly for larger sites or inexperienced users. **Steeper Learning Curve:** It requires a foundational understanding of server concepts, database management, and WordPress architecture. **Higher Risk of Error:** If steps are not meticulously followed, the risk of introducing errors (e.g., broken links, database connection issues, a “White Screen of Death”) is higher. This underscores the absolute necessity of preparation and adherence to best practices, as outlined in this guide. 2. Pre-Migration Checklist: Preparing for a Smooth Transition The success of any migration, especially a manual one, hinges almost entirely on the quality of your preparation. Neglecting this phase is the most common reason for migration failures and prolonged troubleshooting. Consider this your blueprint for minimizing risk and ensuring a seamless transition. Comprehensive Backup Protocol: Your Ultimate Safety Net Before you touch a single file or database entry, a complete, verifiable backup is not just recommended; it is **absolutely mandatory**. This is your rollback point, your insurance policy against unforeseen complications. Without it, any significant error could lead to irreversible data loss. **Full Database Backup (SQL file):** This captures all your posts, pages, comments, settings, user data, plugin configurations, and theme options. Use phpMyAdmin’s export feature (detailed in Step 3) or a reliable database backup tool. Verify the `.sql` file’s integrity; a common mistake is assuming the backup is good without checking its size or attempting a partial import on a test database. **Complete WordPress File System Backup:** This includes all your core WordPress files, themes, plugins, uploads (images, videos, documents), and critical configuration files like `.htaccess` and `wp-config.php`. Download the entire WordPress installation via FTP/SFTP. Double-check that all directories and hidden files are included. **Backup Storage:** Store your backups in a secure, off-site location separate from both your old and new hosting environments. Cloud storage (Dropbox, Google Drive, S3) or a local external drive are excellent options. **Statistical Imperative:** **Approximately 70% of migration failures are attributed to inadequate backups or incomplete pre-migration planning.** This statistic from our DebugPress.com data unequivocally highlights the critical importance of this step. Do not become part of this statistic. Gathering Essential Credentials: Know Your Access Points Accessing both your old and new hosting environments will require a specific set of login credentials. Gather these beforehand and keep them in a secure, encrypted location (e.g., a password manager). **FTP/SFTP Login Details:** For both your old (source) and new (destination) hosts. This includes hostname, username, password, and port (usually 21 for FTP, 22 for SFTP). **Database Username & Password:** For the MySQL/MariaDB databases on both environments. You’ll typically find these in your host’s control panel or by examining the `wp-config.php` file on your old site. **Control Panel Access:** Login details for your hosting control panel (e.g., cPanel, Plesk, DirectAdmin, custom dashboard) for both hosts. This is where you’ll manage databases, file managers, and domain settings. **Domain Registrar Access:** If you’re changing domain pointers (DNS), you’ll need access to your domain registrar (e.g., Namecheap, GoDaddy). New Host Environment Assessment: Compatibility is Key Before moving your site, ensure your new hosting environment is fully compatible and adequately provisioned for your WordPress installation. This prevents performance bottlenecks and compatibility errors post-migration. **PHP Version Compatibility:** WordPress has minimum PHP version requirements (currently PHP 7.4 or greater is recommended, with 8.x being ideal). Verify your new host supports a compatible PHP version. **Database Server Type & Version:** Confirm the new host uses MySQL or MariaDB and that the version is compatible with your WordPress installation (usually MySQL 5.7+ or MariaDB 10.2+). **Adequate Disk Space & Memory Limits:** Ensure the new hosting plan offers sufficient disk space for your files and database, and that PHP memory limits (`memory_limit`) are adequate (e.g., 256MB or 512MB). **Security & Performance Features:** Familiarize yourself with the new host’s security (firewall, malware scanning) and performance (caching, CDN integration) features, and how they might interact with your site. Site Preparation: Minimizing Variables and Inconsistencies Taking a few precautionary steps on your *old* site can prevent data inconsistencies or performance issues during the migration process. **Disable Caching, Security, and CDN Plugins:** These plugins can cache old URLs or block legitimate transfers. Disable them temporarily to ensure the latest version of your site is transferred and accessible. **Activate Maintenance Mode:** Use a plugin or manually add a snippet to your `functions.php` (if comfortable) to put your site in maintenance mode. This prevents new content or comments from being added during the migration, avoiding data loss or inconsistencies. **Update WordPress, Themes, and Plugins:** Ensure your existing WordPress core, themes, and plugins are all updated to their latest stable versions on the old site. This ensures better compatibility with a new server environment and reduces the chance of migrating outdated code with known vulnerabilities. 3. Step 1: Exporting Your WordPress Database The WordPress database is the heart of your site, containing all your content, settings, and user data. Exporting it accurately is a critical first step in the migration process. Accessing phpMyAdmin: Your Database Gateway phpMyAdmin is the most common web-based tool for managing MySQL and MariaDB databases, provided by nearly all hosting providers. You’ll typically find a link to phpMyAdmin within your hosting control panel (e.g., cPanel, Plesk, DirectAdmin). **Login:** Navigate to your control panel, locate the “Databases” section, and click on “phpMyAdmin.” You might need to enter your cPanel/Plesk credentials again, or it might log you in automatically. **Interface Familiarization:** Once inside, you’ll see a list of databases on the left-hand sidebar and the main content area for managing tables, queries, and operations. Selecting the Correct Database: Identify Your Site’s Data It’s crucial to export only your WordPress database, especially if you have multiple databases on your hosting account. Incorrectly selecting a database could lead to exporting irrelevant data or, worse, missing essential WordPress tables. **Check `wp-config.php`:** The most definitive way to identify your WordPress database is by looking at your `wp-config.php` file on your old server. Download it via FTP/SFTP (if you haven’t already). Look for the line `define(‘DB_NAME’, ‘your_database_name’);`. The value within the single quotes is your database name. **Select in phpMyAdmin:** In phpMyAdmin, click on the database name identified from `wp-config.php` in the left sidebar. This will display all the tables belonging to that specific database in the main pane. Executing the Export: Precision with SQL Once your WordPress database is selected, you can proceed with the export. We recommend using the ‘Custom’ export method for granular control, ensuring all necessary data is included and formatted correctly. **Navigate to Export Tab:** With your database selected, click on the “Export” tab at the top of the phpMyAdmin interface. **Choose Export Method:** Select the “Custom” radio button. While “Quick” is available, “Custom” provides options to optimize the export for migration purposes. **Select Tables:** Ensure “Select All” tables are chosen. This guarantees all WordPress core tables, as well as plugin and theme-specific tables, are included. **Output Format:** Confirm that “SQL” is selected as the format. This is the standard for database backups and imports. **Compression:** For smaller databases, “None” is fine. For larger databases, “gzipped” or “zipped” can reduce file size, but you’ll need to uncompress it before importing. **Object Creation Options:** Under “Object creation options,” ensure “ADD DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER statement” is checked. This ensures that during import, existing tables (if any) are dropped before new ones are created, preventing conflicts. **Data Creation Options:** Ensure “IF NOT EXISTS” is selected for adding `CREATE TABLE` statements. **Save Output:** Ensure “Save output to a file” is checked, and you can give it a meaningful name like `your_site_name_date.sql`. **Execute:** Click the “Go” button. Your browser will prompt you to download the `.sql` file. Save it to your local machine in a safe, easily accessible location. Alternative Export Methods: Speed and Automation For those comfortable with command-line interfaces or managing very large databases, alternative export methods offer increased efficiency. **WP-CLI (`wp db export`):** If you have SSH access to your old server and WP-CLI is installed, this is the most efficient method for exporting your database. Simply navigate to your WordPress root directory and run: wp db export database_backup.sql This command is faster and more reliable for large databases, avoiding phpMyAdmin’s potential timeout issues. **Host-Provided Database Tools:** Some hosting providers offer their own database management tools within their control panel, which may have specialized export options designed for their infrastructure. Consult your host’s documentation. 4. Step 2: Transferring Your WordPress Files With your database safely exported, the next crucial step is to transfer your entire WordPress file system. This includes the WordPress core, all your themes, plugins, media uploads, and critical configuration files. Connecting via FTP/SFTP: Secure File Transfer An FTP (File Transfer Protocol) or SFTP (Secure File Transfer Protocol) client is essential for moving files between your local computer and your web server. **SFTP is highly recommended** due to its encrypted connection, which protects your credentials and data during transfer. **Choose an FTP/SFTP Client:** Popular clients include **FileZilla** (free, cross-platform), Cyberduck (Mac/Windows), or Transmit (Mac). We’ll refer to FileZilla for this guide. **Connect to Old Host:** Open your FTP/SFTP client. In FileZilla, use the “Quickconnect” bar or “Site Manager” to enter your old host’s SFTP credentials (Host: `sftp.yourdomain.com` or IP address, Username, Password, Port: `22`). Click “Connect.” **Navigate File System:** On the left pane of FileZilla, you’ll see your local computer’s file system. On the right, you’ll see your remote server’s file system. Identifying the WordPress Root Directory: Locate Your Installation The WordPress root directory is where all your WordPress core files (`wp-admin`, `wp-includes`, `wp-content`, `wp-config.php`, etc.) reside. It’s vital to identify this correctly to ensure you download and later upload the entire site. **Common Locations:** This directory is typically named `public_html`, `www`, `htdocs`, or sometimes a subdirectory within one of these (e.g., `public_html/my-site`). **Verification:** Look for the `wp-config.php` file, `wp-content` folder, `wp-admin` folder, and `wp-includes` folder. These are the definitive indicators of your WordPress root. Downloading All Files: A Complete Local Copy Once you’ve located the WordPress root directory on your old server, download its entire contents to a dedicated folder on your local machine. **Create Local Folder:** On your local computer (left pane in FileZilla), create a new, empty folder specifically for your WordPress site’s files (e.g., `MySite_WordPress_Files_Backup`). **Select All Files and Folders:** On the remote server (right pane), navigate into your WordPress root directory. Select all files and folders within it. You can typically do this by clicking the first item, holding `Shift`, and clicking the last item, or using `Ctrl+A` (Windows) / `Cmd+A` (Mac). **Initiate Download:** Drag and drop the selected files and folders from the remote server pane to your newly created local folder. Alternatively, right-click and choose “Download.” **Ensure Hidden Files are Transferred:** Crucially, confirm that your FTP/SFTP client is configured to show and transfer hidden files (files starting with a dot, like `.htaccess`, `.user.ini`). These files often contain critical server configurations. In FileZilla, go to “Server” > “Force showing hidden files.” **Verify Transfer Completion:** Wait patiently for the transfer to complete. Check the transfer queue for any failed files and re-attempt if necessary. Confirm the size of the downloaded folder on your local machine roughly matches the size on the server. Uploading to the New Host: Populating the New Environment Once your files are safely on your local machine, the process is reversed to upload them to your new hosting provider. **Disconnect Old Host & Connect to New:** Disconnect from your old server in your FTP/SFTP client. Then, use your new host’s SFTP credentials to connect to the new server. **Navigate to New Web Root:** On the new server (right pane), navigate to the designated web root directory where your WordPress site will reside. This is often `public_html` or `www`. Ensure this directory is empty or contains only default host files you can safely overwrite or delete. **Upload All Files:** On your local machine (left pane), navigate to the folder where you downloaded your WordPress files. Select all files and folders within it. **Initiate Upload:** Drag and drop these files from your local folder to the new host’s web root directory. Alternatively, right-click and choose “Upload.” **Monitor and Confirm:** The upload process can take considerable time depending on your internet speed and the size of your site. Monitor the transfer queue closely for any errors. Permissions Best Practices: Ensuring Functionality and Security File and folder permissions are vital for both the security and functionality of your WordPress site. Incorrect permissions can lead to “Internal Server Error,” inability to upload media, or security vulnerabilities. **Standard WordPress Permissions:** **Folders (directories):** Set to `755`. This allows the owner to read, write, and execute; the group and others can only read and execute. **Files:** Set to `644`. This allows the owner to read and write; the group and others can only read. **`wp-config.php`:** Crucially, this file often requires stricter permissions like `640` or even `600` for enhanced security, as it contains your database credentials. **How to Set Permissions (FileZilla):** Right-click on a file or folder in the remote site pane, select “File permissions…”, enter the numeric value (e.g., 755), and check “Recurse into subdirectories” if applying to a folder (and select “Apply to directories only” or “Apply to files only” as appropriate). Apply these recursively to your `wp-content` folder for themes, plugins, and uploads. **Consult Your Host:** Always check with your hosting provider for any specific permission recommendations, as some environments may vary. 5. Step 3: Creating a New Database and Importing Data With your WordPress files uploaded to the new server, the next step is to set up a fresh database environment and import the SQL data you exported earlier. This re-establishes your site’s content and settings in its new home. New Host Database Creation: The Foundation You’ll need to create a new, empty database on your new hosting account. This process is typically handled through your host’s control panel. **Access Control Panel:** Log in to your new host’s control panel (e.g., cPanel, Plesk). **Locate Database Section:** Find the “Databases” or “MySQL Databases” section. **Create New Database:** **cPanel:** Use the “MySQL Database Wizard.” This guides you through creating a database, a user, and assigning privileges in sequence. **Plesk:** Navigate to “Websites & Domains,” select your domain, then go to “Databases,” and click “Add Database.” Give your database a memorable, but secure, name (e.g., `wp_mysite`). **Create New Database User:** Create a dedicated database user. **Crucially, generate a strong, unique password** for this user. Do not reuse passwords. Make sure to record the database name, username, and password securely. **Assign Privileges:** Grant **all privileges** to the newly created user for the new database. This ensures WordPress has full read and write access. **Record Credentials:** Carefully note down the **Database Name**, **Database User**, and **Database Password**. You will need these for `wp-config.php` in the next step. Importing the SQL File: Populating the New Database Now, you’ll use phpMyAdmin on your *new* host to import the `.sql` file you exported from your old site. **Access phpMyAdmin (New Host):** Log in to your new host’s control panel and access phpMyAdmin for the *newly created database*. Ensure you select the correct, empty database from the left sidebar. **Navigate to ‘Import’ Tab:** Click on the “Import” tab at the top of the phpMyAdmin interface. **Select SQL File:** Click the “Choose File” or “Browse” button and select the `.sql` file you downloaded from your old site. **Character Set:** Ensure the character set matches your old database (usually `utf8` or `utf8mb4`). phpMyAdmin often auto-detects this. **Format:** Confirm the format is “SQL.” **Execute Import:** Click the “Go” button at the bottom of the page. **Monitor Process:** The import process might take some time, especially for larger databases. Do not close your browser tab until it reports successful completion. Troubleshooting Import Errors: Common Roadblocks Database imports can sometimes encounter issues. Here are common problems and their solutions: **File Size Limits:** Hosting providers often have limits on the size of files that can be uploaded via phpMyAdmin. **Solution:** If your SQL file is too large, you’ll need to upload it via SFTP to a temporary directory on your server and then use SSH to import it via the command line (`mysql -u your_user -p your_database < your_file.sql`). Alternatively, ask your host to increase the `upload_max_filesize` and `post_max_size` PHP directives temporarily, or use a tool like BigDump. **Incorrect Character Set:** Mismatched character sets can lead to garbled text after import. **Solution:** Ensure both export and import use the same character set (e.g., `utf8mb4_unicode_ci` for modern WordPress). You might need to edit the SQL file to change the character set declaration at the top. **Corrupted SQL File:** The export might have been incomplete or corrupted. **Solution:** Re-export the database from the old host, ensuring a stable connection and checking for any errors during the export process. **Timeout Errors:** phpMyAdmin might time out on large imports. **Solution:** Similar to file size limits, use SSH/WP-CLI for import, or ask your host to increase `max_execution_time` and `memory_limit` in PHP settings. 6. Step 4: Updating the wp-config.php File The `wp-config.php` file is a cornerstone of your WordPress installation, connecting your site to its database. After creating a new database and user on your new host, you must update this file to reflect the new credentials. Locating `wp-config.php`: Your Site’s Central Configuration This critical file is located in the root directory of your WordPress installation. You uploaded it in Step 2, and it should now be on your new server. **Access via FTP/SFTP:** Connect to your new server via your FTP/SFTP client. Navigate to your WordPress root directory (e.g., `public_html`). **Download for Editing:** Locate `wp-config.php` and download a copy to your local machine. Use a plain text editor (like Visual Studio Code, Notepad++, Sublime Text) to open it. **Do NOT use a word processor.** Editing Database Connection Details: The New Credentials Within `wp-config.php`, you’ll find a section defining the database connection settings. You need to update these four lines with the credentials for the database you created in Step 5. Locate these lines (they might look slightly different but will contain `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `DB_HOST`): define('DB_NAME', 'old_database_name'); define('DB_USER', 'old_database_user'); define('DB_PASSWORD', 'old_database_password'); define('DB_HOST', 'old_database_host'); Update them as follows: `define(‘DB_NAME’, ‘your_new_database_name’);`Replace `’old_database_name’` with the exact name of the database you created on your new host. `define(‘DB_USER’, ‘your_new_database_user’);`Replace `’old_database_user’` with the exact username you created for the new database. `define(‘DB_PASSWORD’, ‘your_new_database_password’);`Replace `’old_database_password’` with the strong, unique password you assigned to the new database user. `define(‘DB_HOST’, ‘localhost’);`Most commonly, the database host is `’localhost’`. However, some hosting providers use a different hostname (e.g., a specific IP address or `mysql.yourdomain.com`). If `localhost` doesn’t work, check your new host’s documentation or contact their support for the correct `DB_HOST` value. After making these changes, save the `wp-config.php` file on your local machine. Upload the modified `wp-config.php` file back to your WordPress root directory on the new server via FTP/SFTP, overwriting the old file. This is crucial for your site to connect to the new database. Updating Authentication Unique Keys and Salts (Optional but Recommended): Enhanced Security Below the database connection details in `wp-config.php`, you’ll find a section for “Authentication Unique Keys and Salts.” These are security keys that encrypt user cookies and improve overall site security. While not strictly necessary for migration, updating them is a robust security practice, especially when moving to a new environment. **Generate New Salts:** Visit the official WordPress.org secret key generator: `https://api.wordpress.org/secret-key/1.1/salt/`. **Copy New Keys:** The page will display a new set of unique key and salt definitions. Copy all these lines. **Replace in `wp-config.php`:** In your locally edited `wp-config.php` file, replace the old set of keys with the newly generated ones. **Save and Upload:** Save the `wp-config.php` file and upload it back to your new server, overwriting the existing file. This action will invalidate all currently logged-in user sessions, forcing everyone (including yourself) to log back in, which is a desirable security outcome post-migration. 7. Step 5: Updating URLs in the Database This is arguably the most critical and error-prone step in any WordPress migration. Your WordPress database contains numerous references to your old domain (e.g., `http://old-domain.com`). If these are not correctly updated to your new domain (e.g., `https://new-domain.com`), you’ll encounter broken links, missing images, dysfunctional plugins, and general site instability. The Critical URL Replacement: Why It’s Indispensable WordPress stores URLs in various places within its database, not just in obvious settings. Post content, image paths, internal links, plugin options, widget configurations, and serialized data all contain references to your site’s domain. A simple file transfer and database import will leave these references pointing to the old domain, leading to a broken site. Why Direct Find/Replace is Risky: The Peril of Serialized Data Many novice users attempt a direct SQL find/replace command (e.g., `UPDATE wp_posts SET post_content = REPLACE(post_content, ‘old-domain.com’, ‘new-domain.com’);`). **This is highly dangerous and should be avoided at all costs for a full site migration.** WordPress (and many plugins) store complex data structures (arrays, objects) in the database as **serialized data**. This data includes information about its length. A direct find/replace operation will change the string length but won’t update the corresponding length indicator in the serialized string. This corruption makes the data unreadable, leading to broken widgets, inaccessible plugin settings, and even site crashes. To safely update URLs, you must use tools designed to handle serialized data correctly. Recommended Tools for Safe URL Updates: The Expert’s Choice As experts at DebugPress.com, we strongly recommend these methods for their reliability and ability to handle serialized data gracefully: A. Search and Replace Plugin (Temporary Installation) This is the most common and user-friendly method for manual migrations, especially for those less comfortable with the command line. **Initial Access (Temporary Fix):** Before using the plugin, you might need a temporary fix to access your new WordPress admin dashboard. In your `wp-config.php` (after the database credentials), add these lines: define('WP_HOME','http://new-domain.com'); define('WP_SITEURL','http://new-domain.com'); **Important:** Replace `http://new-domain.com` with your actual new domain. Use `http` initially if you haven’t configured SSL yet. **Remove these lines after the migration is complete and the URL update is done.** They are hardcoded values and can conflict with the database settings later. **Login to New Admin:** With these lines temporarily added, you should be able to log in to your new WordPress admin dashboard (e.g., `http://new-domain.com/wp-admin`). **Install & Activate Better Search Replace:** Go to `Plugins > Add New`, search for “Better Search Replace” (by Delicious Brains), install, and activate it. **Navigate to Tool:** Go to `Tools > Better Search Replace`. **Perform Search/Replace:** In the “Search for” field, enter your **old domain URL** (e.g., `http://old-domain.com`). In the “Replace with” field, enter your **new domain URL** (e.g., `https://new-domain.com`). **Crucially, include `http://` or `https://` consistently.** If you’re moving from HTTP to HTTPS, perform two passes: first `http://old-domain.com` to `https://new-domain.com`, then `http://new-domain.com` to `https://new-domain.com` (to catch any lingering internal HTTP links). **Select Tables:** Select all tables in the database to ensure comprehensive replacement. **Dry Run First:** Check the “Run as dry run?” checkbox. This will simulate the changes without making them, showing you how many instances would be updated. Review the results to confirm it looks correct. **Execute Live Run:** If the dry run looks good, uncheck “Run as dry run?” and click “Run Search/Replace” to execute the changes. **Remove Temporary `wp-config.php` Lines:** After the search and replace is complete, remove the `define(‘WP_HOME’, …)` and `define(‘WP_SITEURL’, …)` lines from your `wp-config.php` file, save, and re-upload. **Statistical Insight:** **Over 35% of post-migration issues are related to incorrect database URL updates, highlighting the importance of specialized tools for this step.** Using a dedicated search and replace tool like Better Search Replace or WP-CLI drastically reduces this risk. B. WP-CLI (`wp search-replace`): The Developer’s Power Tool For command-line users and larger sites, WP-CLI offers the fastest and most efficient way to perform URL replacements. It handles serialized data automatically. **Access SSH:** You’ll need SSH access to your new server. Connect using a terminal or SSH client. **Navigate to WordPress Root:** Change directory to your WordPress installation root (where `wp-config.php` is located). **Perform Search/Replace:** Execute the following command: wp search-replace 'http://old-domain.com' 'https://new-domain.com' --skip-columns=guid --all-tables Replace `’http://old-domain.com’` with your actual old domain. Replace `’https://new-domain.com’` with your actual new domain. `–skip-columns=guid`: It’s standard practice to skip the `guid` column in `wp_posts` as it’s meant to be a permanent identifier for syndicated content and typically shouldn’t change. `–all-tables`: Ensures the operation runs across all tables in your database. **Optional `dry-run`:** Add `–dry-run` to the command to see what changes would be made without actually executing them. This is highly recommended first. **Optional `precise`:** For extremely large sites or very complex serialized data, `–precise` can be used, though it’s slower. C. SQL Queries (Advanced/Caution): Manual Override for Specific Tables This method should only be used if the above methods fail or for very specific, non-serialized data updates. **Proceed with extreme caution and only if you fully understand SQL and serialized data.** It is not recommended for a full site URL migration. For instance, to update `siteurl` and `home` options in the `wp_options` table: UPDATE wp_options SET option_value = REPLACE(option_value, 'http://old-domain.com', 'https://new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl'; This only changes two specific values and does not touch serialized data in other tables. This is primarily a fallback to gain admin access if all else fails before running a proper search/replace tool. 8. Step 6: Post-Migration Checklist & Testing Successfully transferring files and updating database URLs is a major accomplishment, but the migration isn’t truly complete until you’ve rigorously tested your site in its new environment. This phase ensures everything is functioning as expected and identifies any lingering issues. Flushing Permalinks: Rebuilding URL Structures WordPress permalinks are stored in the database and handled by `.htaccess` rules (for Apache) or Nginx configurations. After a migration, it’s essential to re-save them to ensure they are correctly set up on the new server and that the `.htaccess` file (if applicable) is regenerated with the correct paths. **Login to Admin:** Log in to your WordPress admin dashboard on the new server. **Navigate to Permalinks:** Go to `Settings > Permalinks`. **Save Changes (Twice):** Without making any changes to the permalink structure, simply click “Save Changes” once. Then, click “Save Changes” a second time. This action forces WordPress to flush and regenerate the permalink rules and update the `.htaccess` file. Clearing All Caches: Presenting the Fresh Site Caching can prevent you from seeing the updated version of your site, even after a successful migration. Clear all layers of caching to ensure you’re viewing the latest content from the new server. **WordPress Plugin Caches:** If you re-enabled caching plugins (e.g., WP Super Cache, WP Rocket, W3 Total Cache), clear their caches from their respective settings pages in the WordPress admin. **Server Caches:** Many hosts implement server-level caching (e.g., Varnish, LiteSpeed Cache). Clear these through your hosting control panel or by contacting support. **CDN Caches:** If you use a Content Delivery Network (CDN) like Cloudflare, purge its cache. **Browser Cache:** Clear your browser’s cache (or use an incognito/private browsing window) to ensure you’re not viewing a cached version of the old site. Thorough Functional Testing: Your Site’s Health Check This is where you act as a meticulous quality assurance tester. Go through every aspect of your site as both an administrator and a logged-out visitor. **Pages, Posts, and Custom Post Types:** Navigate to every major page, a selection of posts, and any custom post types you have. Check content rendering, formatting, and responsiveness. **Images, Media Embeds, and External Links:** Verify that all images display correctly and that media embeds (videos, audio) play. Click on a variety of internal and external links to ensure they resolve correctly and aren’t broken. **Form Submissions, Comments, User Login/Registration:** Test all forms (contact forms, subscription forms) to ensure they submit correctly and you receive notifications. Leave a test comment. Attempt to log in as a registered user and try to register a new user if applicable. **Active Plugins and Theme Functionalities:** Test every active plugin’s core functionality. If you have an e-commerce site, run through the entire purchase process. Check theme-specific features (e.g., sliders, custom headers, footers). **Responsiveness Across Devices:** Check your site’s appearance and functionality on different screen sizes (desktop, tablet, mobile) to ensure responsiveness is intact. **Speed and Performance:** Use tools like Google PageSpeed Insights or GTmetrix to assess the initial performance on the new server. Compare it to your old site’s performance if you have baseline data. Error Log Review: Hidden Issues Even if your site appears to be working, backend errors could be silently occurring. Always check server error logs for any issues. **Access Logs:** Your hosting control panel will usually provide access to PHP error logs, Apache/Nginx error logs, and WordPress debug logs. **Enable WordPress Debugging (Temporarily):** To get more detailed WordPress-specific errors, temporarily add the following to your `wp-config.php` (above `/* That’s all, stop editing! Happy publishing. */`): define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 ); This will log errors to a `debug.log` file in your `wp-content` directory without displaying them publicly. **Remember to remove these lines once debugging is complete.** DNS Propagation: The Final Piece The last step, if you’re changing hosting providers, is to update your domain’s DNS records to point to the new server’s IP address. This tells the internet where to find your website. **Update A Record:** Log in to your domain registrar (e.g., Namecheap, GoDaddy). Locate your domain’s DNS settings. Find the “A record” (or “Host record”) for your domain and update its value to the IP address of your new hosting server. Your new host will provide this IP address. **Update Nameservers (Optional):** If your new host provided new nameservers, you can update those at your domain registrar instead of just the A record. This is a more comprehensive change that hands over DNS control to your new host. **Be Patient:** DNS changes are not instantaneous. They undergo a process called **DNS propagation**, which can take anywhere from a few minutes to **24-48 hours** globally to fully update. During this time, some visitors might still see your old site, while others see the new one. Use a DNS checker tool (e.g., `whatsmydns.net`) to monitor propagation progress. **Contextual Statistic:** **WordPress powers over 43% of all websites on the internet, making migration a frequent necessity for millions of users annually.** Understanding DNS propagation is crucial for anyone managing these sites. 9. Troubleshooting Common Migration Issues Even with meticulous preparation, issues can sometimes arise. Knowing how to diagnose and resolve common migration problems quickly is a hallmark of an expert. Here are the most frequent challenges and their definitive solutions. Database Connection Errors (`Error establishing a database connection`) This is one of the most common errors and usually indicates a problem with how your WordPress site is trying to connect to its database. **Diagnosis:** When you visit your site, you see a plain white page with the text “Error establishing a database connection.” **Solution:** **Verify `wp-config.php`:** Double-check the `DB_NAME`, `DB_USER`, `DB_PASSWORD`, and `DB_HOST` values in your `wp-config.php` file. Ensure they exactly match the credentials for the database you created on your new host (case-sensitive!). **Database User Privileges:** Confirm that the database user has been granted **all privileges** to the new database. **`DB_HOST` Value:** While `’localhost’` is common, verify with your host if they use a specific IP address or hostname for the database server. **Database Existence:** Confirm the database actually exists and is active on the new server. Internal Server Error (500) A generic error that indicates something went wrong on the server, but it doesn’t specify what. It’s often related to server configurations or code execution. **Diagnosis:** You see “Internal Server Error” or “500 Error” when accessing your site. **Solution:** **`.htaccess` Issues:** The most frequent culprit. Old `.htaccess` rules might be incompatible with the new server. Try renaming your `.htaccess` file (e.g., to `.htaccess_old`) via FTP/SFTP. If the site loads, go to `Settings > Permalinks` in WordPress admin and simply click “Save Changes” twice to generate a new, compatible `.htaccess` file. **PHP Memory Limits:** Your site might be exceeding the PHP memory limit. Increase `memory_limit` in your PHP configuration (e.g., `php.ini` or via your host’s PHP selector). **Incorrect File Permissions:** Ensure files are `644` and directories are `755`. Incorrect permissions can prevent the server from executing scripts. **Corrupt Files:** Re-upload core WordPress files (excluding `wp-content`) to rule out corruption during transfer. Broken Links/Images (Missing Content) This is a clear indicator that the URL replacement in your database was incomplete or incorrect. **Diagnosis:** Images are broken (show a missing image icon), internal links lead to 404s or the old domain, or some content isn’t displaying correctly. **Solution:** **Re-run URL Replacement:** Go back to Step 7 and carefully re-run the `wp search-replace` command via WP-CLI or the “Better Search Replace” plugin. Ensure you’ve covered all instances of `http://old-domain.com` to `https://new-domain.com` (and potentially `http://new-domain.com` to `https://new-domain.com` if moving to SSL). **Check `wp_options`:** As a very specific check, verify `siteurl` and `home` values in the `wp_options` table directly via phpMyAdmin. **File Transfer Incompleteness:** Confirm all files, especially in `wp-content/uploads`, were transferred completely to the new server. White Screen of Death (WSOD) A blank white page, often indicating a fatal PHP error without error reporting enabled. **Diagnosis:** Your browser displays a completely blank page. **Solution:** **Enable Debugging:** Add the `WP_DEBUG` lines to `wp-config.php` as detailed in the “Error Log Review” section (Step 8). This will often reveal the underlying PHP error. **Plugin/Theme Conflict:** The most common cause. Access your site via SFTP, rename your `wp-content/plugins` folder to `plugins_old`. This deactivates all plugins. If the site comes back, reactivate plugins one by one to find the culprit. Do the same for your active theme if plugins aren’t the issue. **PHP Version Incompatibility:** A plugin or theme might not be compatible with the PHP version on your new server. Try switching PHP versions via your host’s control panel. Missing Content/Styles Parts of your site’s content, styling, or functionality are absent. **Diagnosis:** Pages load, but content is missing, styling is off (plain HTML), or specific features don’t work. **Solution:** **Incomplete File Transfer:** Ensure your `wp-content` directory, especially `themes`, `plugins`, and `uploads` folders, were fully transferred. **Incomplete Database Import:** Verify your database import completed successfully and that all tables from the old database are present in the new one. **Permissions:** Incorrect file permissions on CSS/JS files or theme folders can prevent them from loading. Slow Performance Your site loads significantly slower on the new server. **Diagnosis:** Page load times are noticeably longer. **Solution:** **Server Resources:** Your new hosting plan might have insufficient CPU, RAM, or I/O limits. Check your hosting plan details and consider an upgrade. **PHP Configuration:** Optimize PHP settings like `memory_limit`, `max_execution_time`. Ensure opcache is enabled. **Database Optimization:** If the database is large, optimize its tables via phpMyAdmin (select all tables, then “Optimize table”). **Caching:** Ensure server-level and WordPress caching (plugins) are properly configured and active. **Network Latency:** Check if the geographic location of the new server is farther from your target audience. **Expert Insight:** **Expert manual migrations typically reduce post-launch troubleshooting time by 20-30% compared to automated plugin migrations, due to a deeper understanding of potential issues.** This emphasizes the value of the knowledge gained through the manual process. FAQs: Your Pressing Questions Answered What if my WordPress site is very large? Is manual migration still feasible? While possible, very large sites (especially those with multi-gigabyte filesystems or extensive databases) can indeed be time-consuming for manual transfer. For such scenarios, **WP-CLI is highly recommended** for both database export/import and file transfers (using `rsync` over SSH). It handles large volumes of data much more efficiently and reliably than phpMyAdmin or standard FTP/SFTP clients. For extremely complex or massive enterprise-level sites, specialized hosting migration services or professional WordPress development agencies might be a more practical, albeit costlier, option. Do I need to update my DNS records after manual migration? Yes, absolutely. If you are changing hosting providers (i.e., moving from Host A to Host B), you will need to update your domain’s DNS records. The most common change involves updating your domain’s **A record** to point to the new server’s IP address. Alternatively, your new host might provide new **nameservers** that you would configure at your domain registrar. This step is crucial for directing visitors to your new server. Be aware that DNS propagation can take anywhere from a few minutes to **24-48 hours** globally, during which time your site might be accessible from either the old or new server depending on a visitor’s location and their ISP’s DNS cache. Can I migrate a WordPress site from a subdomain (e.g., `dev.example.com`) to the root domain (`example.com`) manually? Absolutely. The manual migration process outlined in this guide is entirely suitable for such a scenario. The core steps of backing up, transferring files, importing the database, and updating `wp-config.php` remain the same. However, the **URL replacement step (Step 7) becomes even more critical**. You must meticulously replace all instances of `dev.example.com` with `example.com` (and ensure consistent `http`/`https` protocols) within your database using tools like Better Search Replace or WP-CLI to avoid broken links and functionality issues. Additionally, ensure your web server on the new host is configured to serve the main domain from the directory where you upload your WordPress files. What are the most common mistakes to avoid during manual migration? Based on our extensive experience at DebugPress.com, the most frequent culprits leading to migration headaches are: **Skipping or Incomplete Backups:** Proceeding without a full, verified backup of both files and database is gambling with your data. **Incorrect Database Credentials:** Typos or mismatched `DB_NAME`, `DB_USER`, `DB_PASSWORD`, or `DB_HOST` in `wp-config.php` are a leading cause of “Error establishing a database connection.” **Failing to Update All URLs:** Forgetting the crucial database search/replace, or doing it incorrectly (e.g., direct SQL find/replace on serialized data), results in a broken site with missing images and links. **Overlooking File Permissions:** Incorrect permissions (`777` for folders, for example) create security vulnerabilities or prevent the server from accessing files and executing scripts. **Ignoring Pre-Migration Assessment:** Not checking PHP version, disk space, or memory limits on the new host can lead to compatibility or performance issues. How long does a manual WordPress migration typically take? The duration of a manual WordPress migration can vary significantly based on several factors: **Site Size:** Larger sites (more files, bigger database) naturally take longer to transfer. **User Experience:** An experienced user familiar with server environments and the steps outlined can complete a small to medium-sized site migration within **1 to 3 hours**. **Internet Speed:** File transfer times are heavily dependent on your local internet connection. **Hosting Performance:** Both old and new hosts’ server speeds can impact database export/import and file transfer times. **Unexpected Issues:** Troubleshooting any errors that arise can extend the timeline significantly, potentially taking several hours or even a full day. Always allocate more time than you anticipate, especially for your first few manual migrations. Is it possible to revert if something goes wrong during the migration? Yes, absolutely, **provided you have complete and verified backups** (both files and database) from *before* you started the migration. This is precisely why the “Comprehensive Backup Protocol” is listed as the absolute cornerstone. If an issue occurs on the new server that you cannot resolve, you can: Revert the new server’s files and database to their state before the migration attempt (if your host offers snapshots). Delete the partial migration on the new server and start fresh using your backups. Most importantly, your original site on the old server remains untouched as long as you haven’t pointed your domain’s DNS to the new server. If all else fails, you can always revert your DNS back to the old server’s IP address (if you changed it) and your site will be back to its pre-migration state. This gives you a safe fallback while you re-evaluate your approach. Mastering manual WordPress migration is a valuable skill that provides unparalleled control, deep system understanding, and confidence in managing your digital assets. While it demands attention to detail, the payoff in robust site management is immeasurable. At DebugPress.com, we believe in empowering you with the knowledge to tackle any WordPress challenge head-on. Embrace the process, follow these steps meticulously, and your WordPress site will thrive in its new home.