Error too many redirects

Hi, i need a help. When I access to my website, i see this error ERR_TOO_MANY_REDIRECTS. How to fix it?

I checked your site and I can see too many redirects to the same domain:

302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found
302 Found

It’s something going wrong with your htaccess file.

Options -MultiViews -Indexes
RewriteEngine On
RewriteBase /

# Redirect all HTTP requests to HTTPS
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

# Redirect old file path to new file path
Redirect /public_html/cobra-11-taurus-world-stunt-award
Redirect /fan-day-cobra-11-2017
Redirect /secret-footage-from-episode-for-cologne-carnaval
Redirect /episode-rating-from-season-42
Redirect /pc
Redirect /playstation
Redirect /xbox-360
Redirect /nintendo-3ds

# Hide .html extension
## External Redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,NC]
## ## Internal Redirect
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html

# GZIP Compression

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml

# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

RewriteCond %{HTTP_REFERER} !^*$      [NC]
RewriteCond %{HTTP_REFERER} !^$      [NC]
RewriteCond %{HTTP_REFERER} !^*$      [NC]
RewriteCond %{HTTP_REFERER} !^$      [NC]
RewriteCond %{HTTP_REFERER} !^*$      [NC]
RewriteCond %{HTTP_REFERER} !^$      [NC]
RewriteCond %{HTTP_REFERER} !^*$      [NC]
RewriteCond %{HTTP_REFERER} !^$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|svg|mp4)$ - [F,NC]

<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access 1 month"
# My favicon
ExpiresByType image/x-icon "access 1 year"
# Images
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType text/css "access 1 month"
# Javascript
ExpiresByType application/javascript "access 1 year"
ExpiresByType text/x-javascript "access 1 year"
# Other
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php71 .php .php7 .phtml
# php -- END cPanel-generated handler, do not edit

This is a .htaccess file

While I know with removing this snippet, http won’t redirect to https, but can you temporary disable it to see if that works?

now It redirects but not too many times!


Yes, it’s working!

The line RewriteCond %{HTTPS} !on doesn’t work on your website because you use Cloudflare Flexible SSL. With Flexible SSL, the connection between your visitors and Cloudflare is encrypted, but the connection between Cloudflare and our server is not. So, as far as our server is concerned, your website did not receive a HTTPS connection.

You can replace this with the rule RewriteCond %{HTTP:X-Forwarded-Proto} =http instead, which should do the trick.

Alternatively, you could remove the rules entirely and use Cloudflare’s “Always Use HTTPS” setting.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.