If your website or wp-login page is giving a “too many redirects” error in the browser, many times it’s caused by an SSL mishap, proxy configuration, or plugins. Let’s take a look at the way to fix these most common causes!
Cloudflare Infinite Redirects
If you have your domain behind Cloudflare nameservers, and you are experiencing an infinite redirect, you should try activating Full (strict) SSL mode. First, make sure you have an SSL installed on the domain, within the server.
When you’re sure that you have an SSL appropriately installed, next, login to your Cloudflare account. Select your domain, go to SSL/TLS, and then choose Full (strict) as your encryption mode.
If after enabling this, you then receive mixed content errors, then look here: https://developers.cloudflare.com/ssl/troubleshooting/mixed-content-errors/
Force HTTPS
As long as you have your SSL properly installed on the domain, you can force HTTPS redirect for your website and admin dashboard.
First, check on your Site URL and Admin Dashboard URL. Your “WordPress Address” and “Site Address” are two options that can be configured within the WordPress Dashboard under Settings > General. However, if you have a redirect issue, you will not be able to access this setting this way. Instead it must be edited within the database.
Confirm the database name by opening the wp-config.php file within the website home directory, and look for the line that starts withdefine('DB_NAME', 'abcd_123');
In this example, abcd_123
will be the database name, however yours of course will be different.
Now that you know which database, make a backup of your database.
Backing up database for IONOS Hosting package with phpMyAdmin
Exporting Database Dumps in Plesk
How to Back Up Databases in cPanel
How to Backup Databases with MySQLDumper
Open that database using phpMyAdmin. This should be available from your web hosting panel, Plesk, cPanel, or you may have to install it.
Once you’ve opened the database in phpMyAdmin, click on the database name in the left column to expand the list of tables within. Now look for the table wp_options
and click on it. The table prefix of wp_
may be different, but should end in _option
s.
Now in the main larger column on the right you will see the records in this table. Look for the siteurl
and click on the Edit Field icon (usually on the left of the row). In the input box for option_value
put in https://www.yoursite.com modifying this with/without the www, and of course changing to your real domain name. Click Go to save the information.
Now look for home
within the same table, click Edit Field, input the same as before in option_value (https://www.yoursite.com) and click Go.
Let’s enforce this HTTPS redirect by also providing it in the wp-config.php file. Edit your wp-config.php by adding the following right at the beginning of your file below <?php
define( 'WP_HOME', 'https://www.yoursite.com' );define( 'WP_SITEURL', 'https://www.yoursite.com' );
Replace www.yoursite.com with your site URL.
Clear your web browser’s cache and cookies, and then try accessing the WP-Admin Dashboard again. If it works now, congratulations! If not, keep following along.
Force SSL Admin
You can also force SSL connections for all admin logins and sessions. In your wp-config.php file, add the following to the top, below <?php
define( 'FORCE_SSL_ADMIN', true );
Save the file, clear your browser’s cookies and cache, and try logging in once more.
Were you successful? If not, it could be due to the proxy having the SSL but the server is missing one. Try adding the following right below the previously added line:
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) $_SERVER['HTTPS']='on';else $_SERVER['HTTPS']='off';
Save the file, clear cookies and cache, and try again.
Any luck?
If you’re using Cloudflare for DNS, consider changing the SSL option within Cloudflare to Full/Strict. Flush cache in Cloudflare, clear cookies and cache in browser, and try again. If that didn’t work, try turning the SSL option off in Cloudflare, flush cache, clear cookies and cache, and try once more.
Disable Plugins
If none of the steps above helped to resolve your issue, the next thing to try may be to disable your plugins. You can do this one-by-one by renaming the WordPress plugin folder names (individually, one-by-one) to find the troublemaker. Or you could rename all plugin folders to work backward. Or, you can even rename the wp-content/plugins folder itself, which will disable all plugins.
Reupload wp-admin
Finally, if your wp-admin is broken, you can try re-uploading the wp-admin and wp-includes folders from a fresh install of WordPress.
First, make a backup of your site files, then over-write the wp-includes and wp-admin folders from the new install archive.
More Help
If none of the steps above solved your issue, it may be time to ask for help. You can reach out to the two official WordPress IRC chats, or make a post on the WordPress Help Forum.
IRC chats
https://web.libera.chat/#wordpress
https://web.libera.chat/#wordpress-social
Fixing WordPress Forum
https://wordpress.org/support/forum/how-to-and-troubleshooting/