Migrate wordpress site to new domain
Migrating a WordPress site to a new domain can be a bit of a process, but it's definitely doable. Here's a step-by-step guide to help you through the process:
Before you start:
- Backup your site: Make sure to backup your WordPress site, including the database and files, before making any changes. This will ensure that you can restore your site if anything goes wrong during the migration process.
- Update your DNS: Update your DNS settings to point to the new domain. This may take some time to propagate, so be patient.
Step 1: Update your WordPress configuration
-
Update the
wp-config.php
file: Open thewp-config.php
file in a text editor and update theDB_HOST
,DB_USER
,DB_PASSWORD
, andDB_NAME
variables to reflect the new database settings. -
Update the
wp_options
table: Run the following SQL query to update thewp_options
table with the new domain:UPDATE wp_options SET option_value = REPLACE(option_value, 'old-domain.com', 'new-domain.com') WHERE option_name = 'site_url' OR option_name = 'home_url';
Step 2: Update your theme and plugins
-
Update your theme: Update your theme to reflect the new domain. You may need to update the theme's
style.css
file and any other files that reference the old domain. -
Update your plugins: Update your plugins to reflect the new domain. You may need to update the plugin's settings and any other files that reference the old domain.
Step 3: Update your database
-
Update the
wp_posts
table: Run the following SQL query to update thewp_posts
table with the new domain:UPDATE wp_posts SET post_content = REPLACE(post_content, 'old-domain.com', 'new-domain.com');
-
Update the
wp_links
table: Run the following SQL query to update thewp_links
table with the new domain:UPDATE wp_links SET link_url = REPLACE(link_url, 'old-domain.com', 'new-domain.com');
Step 4: Update your files
-
Update your files: Update any files that reference the old domain, such as images, CSS files, and JavaScript files.
-
Update your robots.txt file: Update your
robots.txt
file to reflect the new domain.
Step 5: Test your site
- Test your site: Test your site to ensure that everything is working correctly and that there are no broken links or images.
- Check for broken links: Use a tool like Broken Link Checker to identify any broken links on your site.
Step 6: Update your DNS
- Update your DNS: Once you've tested your site and confirmed that everything is working correctly, update your DNS settings to point to the new domain.
Step 7: Verify your site
- Verify your site: Verify your site with Google Search Console and Bing Webmaster Tools to ensure that your site is indexed correctly and that there are no issues with your site's crawlability.
That's it! With these steps, you should be able to successfully migrate your WordPress site to a new domain.