There are a few reasons why your WordPress site might be redirecting to the old domain after migration. Here are some possible solutions:
- Check the WordPress settings. The most common reason for this issue is that the WordPress settings have not been updated to reflect the new domain name. To check this, go to Settings > General in your WordPress dashboard and make sure that the Site Address (URL) and WordPress Address (URL) fields are both set to the new domain name.
- Change the site URL in the database. If updating the WordPress settings doesn’t fix the issue, you can try changing the site URL in the database. To do this, you will need to access your WordPress database using a tool like phpMyAdmin. Once you are logged in, locate the wp_options table and look for the siteurl and home options. Change the values of these options to the new domain name and then save your changes.
- Flush the DNS cache. The DNS cache is a temporary storage area that stores information about websites, such as their IP addresses. If the DNS cache is not updated, it may still be pointing to the old domain name, even though you have updated the WordPress settings and database. To flush the DNS cache, you can use a tool like Cloudflare or your web hosting provider’s control panel.
- Use an SEO plugin. There are a number of SEO plugins that can help you with migration issues. These plugins can help you to redirect old URLs to new URLs, update your sitemap, and more. Some popular SEO plugins include Yoast SEO, All in One SEO Pack, and Rank Math.
If you have tried all of the above solutions and your WordPress site is still redirecting to the old domain, you may need to contact your web hosting provider for assistance.
How to Fix WordPress Redirecting to Old Domain After Migration using Rank Math SEO Plugin
Here are the steps on how to fix WordPress redirecting to old domain after migration using Rank Math SEO plugin:
- Install and activate the Rank Math SEO plugin.
- Go to Rank Math » Settings » General.
- In the “Settings” tab, scroll down to the “Migrating to a new domain” section.
- Check the “Enable 301 redirect for old domain” checkbox.
- Enter your old domain name in the “Old domain” field.
- Enter your new domain name in the “New domain” field.
- Click on the “Save Changes” button.
Rank Math will now create a 301 redirect from your old domain to your new domain. This will ensure that your visitors are redirected to the correct domain and that your website’s SEO is not affected by the migration.
Here are some additional tips for fixing WordPress redirecting to old domain after migration:
- Make sure that the DNS for your new domain has propagated completely. This can take up to 72 hours.
- Clear your browser’s cache and cookies.
- Try accessing your website from a different device or network.
- If you are still having problems, contact your web hosting provider for assistance.
How to Fix WordPress Redirecting to Old Domain After Migration using Yoast SEO Plugin
Here are the steps on how to fix WordPress redirecting to old domain after migration using Yoast SEO plugin:
- Go to your WordPress dashboard and install the Yoast SEO plugin.
- Once the plugin is installed and activated, go to SEO > General.
- In the Settings tab, scroll down to the Redirects section.
- Check the box next to Enable 301 redirects for old URLs.
- In the Old URL field, enter your old domain name.
- In the New URL field, enter your new domain name.
- Click Save Changes.
Yoast SEO will now automatically redirect all visitors from your old domain to your new domain.
- If you have a lot of pages on your website, it may take some time for all of the redirects to be processed.
- You can check the status of your redirects in the Tools > Redirects section of the Yoast SEO plugin.
- If you’re still having trouble with redirects, you can contact Yoast SEO support for help.
Here are some other possible causes of WordPress redirecting to old domain after migration and how to fix them:
- The Site Address in WordPress Settings is incorrect. To fix this, go to Settings > General and enter your correct domain name in the Site Address (URL) field.
- The Site URL in the WordPress database is incorrect. To fix this, you’ll need to manually update the Site URL in the database. You can use a database management tool like phpMyAdmin to do this.
- There is a redirect in your .htaccess file that is pointing to the old domain. To fix this, open your .htaccess file and search for any redirects that are pointing to the old domain. Delete these redirects and save the file.
- Your DNS settings are not updated for the new domain. This can cause visitors to be redirected to the old domain even if the Site Address in WordPress Settings and the database are correct. To fix this, you’ll need to update your DNS settings with your domain registrar.
I hope this helps!