PHPMatters Help You Better Hosting Your PHP-based Sites
How to Fix the Too Many Redirects Issue in WordPress

How to Fix the Too Many Redirects Issue in WordPress

When checking your WordPress site, have you ever found that the website is down and your browser gives you a feedback indicating your webpage is not directing properly or your page has the redirect loop? If so, it means your website is undergoing the too many redirects issue.

Frankly speaking, this issue is pretty annoying and may scratch your head. In this case, we’d like to share some secrets of it, telling you the main reasons for causing this problem and some tips about how to fix the too many redirects issue in WordPress.

The General Introduction to the Too Many Redirects Issue

In fact, this error is also called as the 310 error, meaning that your browser cannot figure out your entered URL and does not know where the link is supposed to redirect, thus, the browser simply gives up and throws up the hands.

Actually, your website can be loaded after the site URL is typed into the address bar of your browser correctly. However, things can be wrong if this URL points to different locations, for the browser is not smart enough to make sure the target place, and ends up giving you the error information just like below.

Page Not Redirect Properly

In addition, it is possible that the error message says that there is a redirect loop happened on your website. This will occur when your entered URL is pointing to your WordPress site properly, but the site simply tells the browser to redirect to another place instead. However, when the browser is redirected to a different address, then, it is told to redirect back to your site.

In this case, the browser is simply caught in an endless loop by going back and forth, and then, responds you with an error message.

Page Has Redirect Loop

Common Reasons for the Too Many Redirects Issue

Surely, there are a lot of reasons that may result in this error, and we have listed the most common ones in the following.

  • You have entered the incorrect and different Home URL and Site URL.
  • Some of your plugins might come with the wrong configurations and redirect your pages in the wrong way.
  • There are some improper changes made on your .htaccess file.
  • There are multiple websites or networks hosted on a single IP address.
  • Your site uses the same URL as that of a delete one.

After learning the causes, now, you can check some methods for addressing this issue from the below parts.

Configure the General Settings of WordPress Properly

Firstly, you need to enter the admin of your WordPress powered website by pressing Settings > General. Here, you can find two critical settings – WordPress URL and Site URL. The former one is also known as WordPress address, which indicates the place used to store your site along with its core data and files. The latter one is also called as Site Address, which is the link you want your visitors to enter into the address bar of their browsers for accessing your website.

WordPress General Settings

Here, you have to make sure that these two setting fields are entered with the same URL. If not, you should correct them at once; otherwise, your site can encounter the redirect issue.

In addition, you need to ensure that there is no slash available at the end of these links, and the http:// should be entered. If you have installed the SSL certificate into your site for the security aspect, these links need to be entered with the https:// in the front-end.

Also, both of these links should or should not have the www displayed in the very beginning.

Update the wp-config.php File

It is possible that you cannot access this settings page. If so, you need to update your wp-config.php file to modify your Site URL or the WordPress URL.

To do this, you can connect your site using the FTP and edit the wp-config.php file that can be found in the root directory. After opening this file using the text editor, you can add the below lines using your actual URL, and then, upload this new file to replace the default one.

Update the wp-config.php File

Figure Out the Redirection Plugins

Many WordPress plugins utilize the function of wp_redirect to redirect a particular URL to a page or a post of your website. Typically, these plugins are used to achieve the 301 redirection when you combine multiple posts into a single one, switch to a new domain or change the post permalink. However, if the plugins are not set up properly or there are some bugs included, they may lead to the direction issue on your site.

To resolve the problem, you can deactivate the plugins installed on your site that come with the wp_redirect feature. If you cannot ensure which of your installed plugins bear this function and cause the problem, you can deactivate all the installed plugins firstly, and then, reactivate them one by one until you find the target.

After pointing out the trouble maker, you can check whether there is something wrong with the plugin settings. If changing the settings cannot fix the issue, you’d better try another plugin or contact the plugin developer to report the problem.

Restore Your .htaccess File

In some cases, the redirection issue might occur after you make some changes to the .htaccess file. Due to this, you’d better check this file to figure out whether your updated settings are something wrong. If you cannot spot any mistake, you can restore this file to the default value by following the below steps.

  • Copy and backup the .htaccess file firstly.
  • Delete the current version.
  • Log into the WordPress dashboard and click Settings > Permalinks.
  • Click the Save Settings button to have a new .htaccess file generated automatically.

Now, you can check whether the redirection error happens again on your site. If not, you can add the changes made on the .htaccess file one by one until you find the culprit.

Clear all Your Current Cookies and Cache

Sometimes, you may have already fixed this issue after carrying out the above-mentioned practices. However, the changes will come into effect only when you clean up all the cache and cookies. After all, to have your site loaded quickly, there will be a static website copy saved by your browser or your WordPress cache plugin temporarily. In this case, any new change or update may fail to be reflected until these copies are removed, indicating that your site is under a new copy now.

Clear Cache

Choose to Use the Dedicated IP Address

In fact, the domain name can be viewed as the online address, which is connected to an IP address of where your website is hosted. In this case, when your domain is entered into the browser address bar, it will connect to the corresponding IP address automatically, and then, direct the online users to the right place.

Ideally, each site is connected to an exclusive IP address. However, if you have multiple sites hosted altogether using a single IP, the correct redirection might be broken.

At this point, you can try to upgrade to the dedicated IP address to fix the too many redirects issue, especially when you install and manage the WordPress Multisite Network only using one IP with the shared web hosting solution.