Error too many redirects

Hi, i need a help. When I access to my website afc11-bg.com, 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:

Result
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
302 Found
https://afc11-bg.com/
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 https://www.afc11-bg.com/news-1
Redirect /fan-day-cobra-11-2017 https://www.afc11-bg.com/news-2
Redirect /secret-footage-from-episode-for-cologne-carnaval https://www.afc11-bg.com/news-3
Redirect /episode-rating-from-season-42 https://www.afc11-bg.com/news-4
Redirect /pc https://www.afc11-bg.com/pc-games
Redirect /playstation https://www.afc11-bg.com/playstation-games
Redirect /xbox-360 https://www.afc11-bg.com/xbox-360-games
Redirect /nintendo-3ds https://www.afc11-bg.com/nintendo-3ds-games

# 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/vnd.ms-fontobject
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
</IfModule>

RewriteCond %{HTTP_REFERER} !^http://afc11-bg.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://afc11-bg.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.afc11-bg.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.afc11-bg.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://afc11-bg.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://afc11-bg.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.afc11-bg.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.afc11-bg.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|svg|mp4)$ - [F,NC]

## EXPIRES CACHING ##
<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"
# CSS
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"
</IfModule>
## EXPIRES CACHING ##
# 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
</IfModule>
# 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!

3 Likes

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.

5 Likes

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