Universal WordPress Migration Guide: Moving Sites Safely and Efficiently
Step 1: Backup Your Website
Before making any changes, it’s crucial to create a backup of your entire WordPress website. This ensures that you have a restore point in case anything goes wrong during the migration process.
Step 2: Update WordPress Settings
- Update Site Address:
- Navigate to the WordPress dashboard.
- Go to Settings > General.
- Update both the WordPress Address (URL) and Site Address (URL) to reflect the new domain.
Step 3: Move Website Files
- Update File Paths:
- Using an FTP client or cPanel File Manager, move all website files to the new directory.
- Update paths in configuration files like wp-config.php and .htaccess accordingly.
Step 4: Update Database URLs
- Search and Replace:
- Utilize a tool like “Better Search Replace” or execute SQL queries to update old URLs in the WordPress database to the new ones.
Step 5: Adjust Wordfence Configuration
- Review .user.ini File:
- Locate the .user.ini file in the root directory.
- Update the path to the Wordfence configuration file to match the new directory structure.
Step 6: Check and Update Plugins
- Review Plugin Settings:
- Inspect the settings of security plugins and caching tools to ensure they reflect the new website URL.
Step 7: Verify File and Folder Permissions
- Correct Permissions:
- Check and set the correct file and folder permissions on the server to avoid 403 Forbidden errors.
Step 8: Test Your Website
- Check for Errors:
- Open your website in a browser and thoroughly test its functionality.
- Review server logs for any PHP warnings or errors.
Step 9: Update Cache and Security Plugin Paths
wp-config.php:
- Open the ‘wp-config.php’ file and search for the line containing:
define( ‘WPCACHEHOME’, ‘/home/[your-username]/public_html/old-directory/wp-content/plugins/wp-super-cache/’ );
Update it to reflect the correct path:
- define( ‘WPCACHEHOME’, ‘/home/[your-username]/public_html/wp-content/plugins/wp-super-cache/’ );
config-synced.php:
- Open the ‘config-synced.php’ file in the ‘wp-content/wflogs’ directory and search for the line containing:
“pluginABSPATH”;s:41:”/home/[your-username]/public_html/old-directory/”;
Update it to the correct path:
“pluginABSPATH”;s:41:”/home/[your-username]/public_html/”;
Jetpack WAF Files:
- Open the ‘bootstrap.php’ file in the ‘wp-content/jetpack-waf’ directory and update the following lines:
define( ‘JETPACK_WAF_DIR’, ‘/home/[your-username]/public_html/old-directory/wp-content/jetpack-waf’ );
define( ‘JETPACK_WAF_WPCONFIG’, ‘/home/[your-username]/public_html/old-directory/wp-content/../wp-config.php’ );
Update them to the correct paths:
define( ‘JETPACK_WAF_DIR’, ‘/home/[your-username]/public_html/wp-content/jetpack-waf’ );
define( ‘JETPACK_WAF_WPCONFIG’, ‘/home/[your-username]/public_html/wp-config.php’ );
Step 10: Update wp90_options
Table
- Access the Database:
- Use phpMyAdmin or a similar tool to access your WordPress database.
- Locate the
wp90_options
Table:- Look for the
wp90_options
table in the database.
- Look for the
- Update Site URLs:
- Locate rows with
option_name
containingsiteurl
andhome
. - Update the
option_value
of these rows to match the new website URL.
- Locate rows with
Step 11: Update Permalink Settings
- Access Permalink Settings:
- In the WordPress dashboard, go to Settings > Permalinks.
- Resave Permalink Settings:
- Without making any changes, click the “Save Changes” button.
- This ensures that the permalink structure is updated based on the new URL.
Step 12: Update WordPress URL in wp-config.php
- Open
wp-config.php
:- Access the
wp-config.php
file in the WordPress installation directory.
- Access the
- Update WordPress URL Constant:
- Locate the following lines:
define(‘WP_HOME’, ‘http://example.com’);
define(‘WP_SITEURL’, ‘http://example.com’);
Update the URLs to match the new domain:
define(‘WP_HOME’, ‘http://new-domain.com’); define(‘WP_SITEURL’, ‘http://new-domain.com’);
Conclusion:
By following these additional steps, you ensure that the database, Permalink Settings, and WordPress constants reflect the new URL. This comprehensive approach helps maintain consistency across all aspects of your WordPress site after migration.
Remember to perform thorough testing after making these updates to ensure the correct functioning of your website on the new domain. If any issues arise, refer to your backup or seek assistance from your hosting provider. Happy migrating!