# WordPress Migration Guide: Remote Host to cPanel This guide provides a comprehensive workflow for manually migrating a WordPress installation. ## 1. Retrieve Data from Remote Host 1. **Access Files:** Log in to the remote host using FTP or a provided File Manager. Download the entire document root, which is usually `public_html`. Compress the site into a single `.zip` or `.tar.gz` archive on the remote server before downloading if possible. Compressing prevents data corruption. Verify that hidden files, specifically the `.htaccess` file, are included in your archive or download. This file is required for WordPress permalinks to function correctly. 2. **Export Database:** Log in to the remote phpMyAdmin to access the database. Select the specific WordPress database from the left sidebar and click the Export tab located in the top menu. Select Quick as the "Export Method" and click Go to download the `.sql` file to your local machine. Most remote hosts offer a way to download a copy of a site's database through their interface if there is no phpMyAdmin. A request will need to be raised to the support team of the remote host if this cannot be done through provided tools. ## 2. Upload Files to Destination cPanel 1. **Navigate to Root:** Log in to the destination cPanel and open the File Manager. Navigate to the document root for the domain, such as `public_html` or `public_html/addon_domain`. 2. **Upload and Extract:** Upload the site files or the `.zip` archive you created. Right-click and Extract the files here if you uploaded an archive. Ensure all files are in the root of the folder and not nested inside a sub-folder like `public_html/wordpress/`. 3. **Verify Hidden Files:** Click "Settings" in the top right corner of the cPanel File Manager and check "Show Hidden Files (dotfiles)". This confirms your `.htaccess` file successfully transferred. ## 3. Create the Database Environment 1. **Access Wizard:** Open the MySQL Database Wizard or "MySQL Databases" in cPanel. 2. **Create Database:** Create a new database and note the full name, such as `cpuser_newdb`. 3. **Create User:** Create a new database user with a secure password and note these credentials. 4. **Assign Privileges:** Add the user to the database and check the box for ALL PRIVILEGES. Click Make Changes to finalize the setup. ## 4. Import the SQL Data 1. **Access phpMyAdmin:** Go back to the cPanel main menu and open phpMyAdmin. Click the new, empty database you just created in the left sidebar. 2. **Import File:** Click the Import tab in the top menu, then click Choose File and select the `.sql` dump downloaded previously. Leave "Format" as SQL and other options as default, then click Go. You should see a success message indicating the queries have been executed. 3. **Large File Alternative:** If the `.sql` file exceeds phpMyAdmin's upload limit, import the database via SSH using the command `mysql -u username -p database_name < file.sql` or use a database chunking script like BigDump. ## 5. Update Configuration (wp-config.php) 1. **Edit Config:** Return to the File Manager in the document root. Locate the `wp-config.php` file, right-click, and select Edit. Update the configuration lines with the credentials created previously. 2. **Apply Credentials:** Update `DB_NAME` to the new database name. Update `DB_USER` to the new database username. Update `DB_PASSWORD` to the new password. Ensure `DB_HOST` is set to `localhost`. Save Changes. ## 6. Set Permissions 1. **Access Terminal:** First, SSH into the server. Navigate to the document root using `cd public_html`, adjusting the path if this is an addon domain. If you do not have an SSH client like PuTTY configured, you can execute these commands directly using the "Terminal" application located within cPanel. 2. **Directory Permissions:** Set all folders to 755 to fix directory permissions. Execute the command `find . -type d -exec chmod 755 {} \;` to set directory permissions. 3. **File Permissions:** Set all files to 644 to fix file permissions. Execute the command `find . -type f -exec chmod 644 {} \;` to set file permissions. ## 7. Local Testing (Hosts File) 1. **Locate Hosts File:** Locate the hosts file on your computer. On Windows, the file is at `C:\Windows\System32\drivers\etc\hosts` and must be edited as Administrator. On Mac or Linux, the file is at `/etc/hosts` and can be edited using `sudo nano /etc/hosts`. 2. **Edit Hosts File:** Add a line pointing the domain to the new server IP using the format `123.45.67.89 example.com www.example.com`. 3. **Flush DNS Cache:** Flush your local DNS cache after modifying the hosts file. On Windows, run `ipconfig /flushdns` in the command prompt. On Mac, run `sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder` in the terminal. 4. **Test Site:** Open a private or incognito browser window in a different browser than the one you have been using to bypass cache. Visit the site. Verify the site loads correctly from the new server. 5. **Cleanup:** Remove the line from your hosts file once DNS propagation is complete globally.