Tag Archives: Change WordPress Site URL

Why WordPress Keeps Redirecting You To Old Web Address?

This issue is experienced especially when you move your WordPress site from a subdirectory or subdomain to the main domain. Maybe you have developed your website on a subdomain or directory and now you want to move it to your main domain address.

Whatsoever may be the case, if you see that your domain is still trying to send you to that old address then make sure of the reasons mentioned below.

Have you checked the .htaccess file for any manual redirects?

The .htaccess file is present in the root directory of WordPress. On the server, it is hidden by default. There are some plugins especially cache and SEO plugins that make modifications to this file which may cause redirect issues at the time you migrate your website to a new address.

To make sure your .htaccess file is free from any manual redirects, visit the file manager of your web-hosting or server, navigate to the root directory of your website, and open the .htaccess file for editing.

Next, make sure you don’t have any manual redirect code, if you have then remove it. You may simply remove all additional rules and leave only WordPress default rules in this file.

Have you updated the new address of your website on the admin settings page?

Before moving your website you need to update the new address of your website on Dashboard -> Settings -> General page. You need to update both the ‘Home’ and ‘Site URL’ fields.

In case you don’t do that, your domain will keep redirecting to that old address. Somehow if you forgot to change the URL of your site and have already moved the files then now what you can do is update the wp-config.php file by adding this code –

define('WP_HOME','http://yoursite.com');
define('WP_SITEURL','http://yoursite.com');

Make sure you replace yoursite.com with your own domain name. It simply hardcodes the values on your website.

Another way of doing the same is by editing the wp-options table of your MySQL database.

May be old URL is hardcoded in any of your plugins

Another reason for this error is sometimes some plugin hardcodes the old address of your website and attempts to load it during the login process.

So once you are sure that the ‘Home URL’ and the ‘Site URL’ have been properly updated then the next thing you should do is visit your site’s root directory -> wp-content and rename the ‘Plugin’ folder. This will simply deactivate all plugins. Now try to open your website.

If this trick works then you can log in to your website and start re-activating plugins one by one. Following this way, you will reach the plugin that is causing the problem. To resolve the issue, simply delete the error-causing plugin.

Next, clear your browser’s cache and see whether the error is gone or not. If the problem persists then use the following comment form to get in touch or you may contact 24/7 phone-call support if you are a user of SANGKRIT.net.