ERR_TOO_MANY_REDIRECTS

Helbert Pernecita

New member
Joined
Dec 1, 2021
Messages
3
Newby here.. i installed one plugins, but suddenly it doesnt work. then i assumed that there is a conflict to other installed plugins, so i deleted the disabled plungins.. then suddenly when i open again my website, it shows error of too many redirects. please help me resolve this case.
 
Do you have some more info?
This does not seems like a DirectAdmin error but more like a website error. Are you using WordPress?
Yes, i installed wordpress... my website is working fine before i installed YOAST SEO, when i installed YOAST SEO, it doesnt work and telling me that there is a conflict with other plugins, so i deleted 2 plugins which im not using..
 
Definitely seems like a WP issue, not DA.

But, having coped with such errors before, you could try adding this to your wp-config.php file:

Code:
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) {
    $_SERVER['HTTPS'] = 'on';
}
 
Definitely seems like a WP issue, not DA.

But, having coped with such errors before, you could try adding this to your wp-config.php file:

Code:
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) {
    $_SERVER['HTTPS'] = 'on';
}
I did but nothing happerned..

1638487081842.png
 
This is not a WP support forum. But as this starts happening by installing a plugin, I would disable all plugins first.
And then enable them one by one and see which one is causing the issue.

Also check other entries and/or customizations you made in .htaccess files which can also cause too many redirect problems.
 
Does anyone understand the underlying cause of this issue (which was never fixed and still persists till today?)

I can get around it by adding what was posted above, and also adding a couple of lines to the functions.php of the active theme:

Code:
update_option( 'siteurl', 'https://www.example.com' );
update_option( 'home', 'https://www.example.com' );

But this breaks the wp-discuz plugin.

Is this just as simple as having the correct .htaccess in the root of "public_html" (in which case it would be nice if that was automated)?

Before I am told that this is not a Wordpress support site, the Wordpress Manager feature is integrated into DirectAdmin. I'm not doing this through Installatron or anything like that, so it should be supported.

DA staff rejected my ticket however, on the grounds of laziness.

This thread is also of interest, but ultimately useless, as disabling SSL redirect in DA does not solve the issue (and the files still must be edited as a workaround):
Site Redirecting Too Many Times

I think it is time to move on to Webuzo.
 
I managed to solve the issue by using Installatron to install Wordpress which generated an .htaccess for me (something DirectAdmin's WordPress manager should do but does not, for some reason):

Code:
# Block the include-only files.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
<Files wp-config.php>
<IfModule !mod_authz_core.c>
order allow,deny
deny from all
</IfModule>
<IfModule mod_authz_core.c>
require all denied
</IfModule>
</Files>

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Creating an .htaccess in the public_html with this code should solve the issue without needing to resort to modifying any Wordpress files.

Unfortunately, it did not solve the issue of the wpdiscuz plugin not working.
 
DA staff rejected my ticket however, on the grounds of laziness.
BS. They don't reject for this reason. It can however happen that your ticket can automatically close because they are too busy. Also keep in mind that it's holiday time. If it get's closed without response and you do have a modern license, you can just open the ticket again.

Unfortunately, it did not solve the issue of the wpdiscuz plugin not working.
Then one should wonder if the creator of that plugin should apply some fixes maybe. Did you report the issue to him already?

As for the .htaccess I agree. Wordpress, Softaculous and Installatron create those .htaccess files, so in fact if DA does the installation, that should be done too.
 
And what error do you have there?
Apologies, that was my own fault - wpdiscuz needs to be manually added to the block layout with Wordpress' new default themes.

I wish to thank Roman for solving my issue.

It turns out you DO NOT need an .htaccess. The issue is in fact Wordpress' fault.

Per Roman's fantastic and thorough investigation: In my domain settings in DirectAdmin, I had force redirect to www set and also force https redirect which is fine and dandy in itself and is generally a good thing to have enabled in my opinion. But Wordpress for some reason does not honour the "WordPress Address (URL)" and "Site Address (URL)" settings and although it is set to "https://www.mysite.com", Wordpress redirects to "https://mysite.com" and ignores the "www". This causes an infinite loop where Wordpress is redirecting to the "www"-less site and then DA is redirecting to the "www" site.

The solution is to hardcode the "www" part in "wp-config.php", per the instructions here:
Rich (BB code):
define( 'WP_HOME', 'https://www.example.com' );
define( 'WP_SITEURL', 'https://www.example.com' );

Thanks for all your help and sorry for doubting you.
 
Last time I had too many redirects on a WP site, it was down to a file permission. Make sure they are all 644, your config.php (and all variants) file should be 640 and if you have a .user.ini file, that should be 600. May not help but that's my 2 cents :)
 
Back
Top