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:

  1. 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.
  2. 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

  1. Update the wp-config.php file: Open the wp-config.php file in a text editor and update the DB_HOST, DB_USER, DB_PASSWORD, and DB_NAME variables to reflect the new database settings.

  2. Update the wp_options table: Run the following SQL query to update the wp_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

  3. 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.

  4. 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

  1. Update the wp_posts table: Run the following SQL query to update the wp_posts table with the new domain:

    UPDATE wp_posts SET post_content = REPLACE(post_content, 'old-domain.com', 'new-domain.com');
  2. Update the wp_links table: Run the following SQL query to update the wp_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

  3. Update your files: Update any files that reference the old domain, such as images, CSS files, and JavaScript files.

  4. Update your robots.txt file: Update your robots.txt file to reflect the new domain.

Step 5: Test your site

  1. Test your site: Test your site to ensure that everything is working correctly and that there are no broken links or images.
  2. Check for broken links: Use a tool like Broken Link Checker to identify any broken links on your site.

Step 6: Update your DNS

  1. 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

  1. 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.