WordPress is one of the easiest website building tools that make use of redirection rules.
However, incorrect URL settings, corrupted plugins, bad rewrite rules, etc. can cause WordPress error Too many redirects.
But how can we know the real reason for this redirection error?
At Bobcares, we receive many requests from website owners to fix their WordPress as part of our Server Management Services.
Today let’s discuss how our Support Engineers find the cause of the WordPress redirection errors and fix it.
“Too many redirects” error in WordPress
Let’s begin by checking the exact error that shows up on the WordPress website.
Often while editing the WordPress website, by adding plugins, or editing content, it can result in redirection errors. Different browsers show up this error in different ways.
For instance, the redirect error shows up in the Chrome browser as:
What causes WordPress error too many redirects?
Troubleshooting the exact reason behind the redirection error is a bit tricky. Let’s discuss some top reasons that our Dedicated Engineers see on WordPress websites.
1. Faulty URL settings
One of the main cause for too many redirects error can be incorrect URL settings in WordPress.
Basically, WordPress has two types of URL settings, home URL and site URL.
We enter the home URL/Site address in the browser to view our website. The site URL/WordPress address contains the site and its core files.
Often bad settings of these URLs result in WordPress redirection errors.
2. Corrupted plugins
Plugins add new features to our WordPress websites. But, corrupted or outdated plugins can even cause redirect errors in WordPress.
The conflict between one or more plugins also creates problems. Disabling those plugins will resolve the error to a greater extent.
3. Incorrect .htaccess file settings
Similarly, the .htaccess file contains the rewrite rules for any WordPress site. Misconfigurations in this file directly result in redirect errors.
Duplicate redirects and incorrect URLs in the file causes this error.
How we fix the errors?
So far we have seen the possible errors that cause the WordPress error too many redirects. Now let’s discuss how our Support Engineers fix these errors efficiently.
1. Changing the URL settings
Recently one of our customers approached us with redirect error in WordPress. Our Dedicated Engineers checked the error and found out that the user had incorrect URLs in home URL and site URL settings.
We had to change the WordPress URL settings of the website. It can be set either from the WordPress Dashboard or from the command line.
From the Administrator dashboard:
To change the URL settings from the WordPress Administrator dashboard,
- Firstly, we log in to the WordPress administrator dashboard.
- Then, we Navigate to Settings >> General Settings.
- After that, we change the WordPress address and Site address accordingly and save the changes made.
However, it is important to add or remove “www” prefix as necessary for both URLs to keep their structure consistent.
Also, we make sure not to include a slash at the end of these addresses to avoid redirection.
From the command line:
When we don’t have access to the WordPress administrator dashboard, we change the URLs in the wp-config.php file.
At first, we log in to the site using SSH.
Then, we edit the wp-config.php file present in the WordPress root directory and add the code,
define('WP_HOME','https://my-site.com');
define('WP_SITEURL','https://my-site.com');
It is important to replace “https://my-site.com” with the actual URL of the site. Again, for security reasons, we use the https version of the website.
Then, it is also important to update the home URL and site URL in the WordPress database. We update it via phpMyAdmin.
- Firstly, we log in to phpMyAdmin.
- Then, we choose our database from the list of databases.
- After that, we click on the wp-options table and locate the site URL and home URL rows.
- Alter the URLs and click on the Go button to save the changes.
2. Disabling the plugins
As we have seen, some plugins in the WordPress site will also cause redirect errors.
Disabling the corrupted plugins will resolve the error. When we cannot find the exact plugin that causes redirection, the best solution is to deactivate all the plugins.
Later, we reactivate the plugins one by one to find the faulty plugin that causes the redirections.
If we have access to the admin panel, we first go to the Plugins area in the dashboard. Then, we disable the plugin by clicking on the deactivate link.
Similarly, we can disable the plugins without having access to the admin panel.
- Firstly, we connect to the WordPress root folder using FTP or SSH
- Then, we navigate to wp-content>>plugins.
- After that, we locate the plugin’s folder and delete it.
3. Renaming .htaccess file
Another method we use to resolve the redirection errors is to double-check the rules in .htaccess file and change it accordingly.
Also, to disable the .htaccess file, we log in to the website hosting server as the root user and use the command,
mv .htaccess .htaccess _backup
If WordPress loads now, that indicates the problem with rewrite rules. Therefore, we create a new .htaccess file with correct rules and check the access of the site. And, the website works fine.
4. Clear cache and cookies
The browser always stores a static copy of our site temporarily. Sometimes, the new changes made on the hosting server may not show up due to cache.
So clearing the browser cache and cookies can resolve the WordPress redirection errors to a great extent.
[Need more help to resolve WordPress redirection errors? –We will help you.]
Conclusion
In short, the WordPress error too many redirects occur mainly due to incorrect URL settings, faulty plugins and misconfigurations in .htaccess files. We also discussed how our Support Engineers fix the errors related to it.
0 Comments