# Err\_too\_many\_redirects

**URL:** <https://forum.infinityfree.com/t/err-too-many-redirects/26977>\
**Category:** Hosting Support\
**Created:** [March 12, 2020, 12:06am UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977 "2020-03-12T00:06:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon2538481](https://forum.infinityfree.com/letter_avatar/anon2538481/32/6_449c533f586939b6e5f246632a46421f.png) [@anon2538481](https://forum.infinityfree.com/u/anon2538481)\
**Post date:** [March 12, 2020, 12:06am UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977/1 "2020-03-12T00:06:10Z")

</div>

**My website URL is:**  
abmsolucoes.cf

**What I’m seeing is:**  
ERR\_TOO\_MANY\_REDIRECTS

When trying to open my site, the message ERR\_TOO\_MANY\_REDIRECTS occurs,  
my .htaccess file is:

```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ http://abmsolucoes.cf/index.php?url=$1 [QSA,L]
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

```

my index.php is:

```
<?php

session_start();

require 'config.php';

spl_autoload_register(function($class){

if(file_exists('controllers/'.$class.'.php')){

require 'controllers/'.$class.'.php';

}else if(file_exists('models/'.$class.'.php')){

require 'models/'.$class.'.php';

}else if(file_exists('core/'.$class.'.php')){

require 'core/'.$class.'.php';

}else{

header("Location: ".BASE_URL);

}

});

$c = new Core();

$c->run();

?>

```

 ![image](https://forum-cdn.infinityfree.net/original/2X/d/dd0b829845344a4f536267ca7fdcfe6309bc1d81.png)

---

<div class="post-metadata">

**Author:** ![anon95130038](https://forum.infinityfree.com/letter_avatar/anon95130038/32/6_449c533f586939b6e5f246632a46421f.png) [@anon95130038](https://forum.infinityfree.com/u/anon95130038)\
**Post date:** [March 12, 2020, 2:43am UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977/2 "2020-03-12T02:43:39Z")

</div>

Theres probably a misconfiguration in your .htaccess file that your ssl certificate doesn’t understand. Are you using Let’s encrypt?

---

<div class="post-metadata">

**Author:** ![anon2538481](https://forum.infinityfree.com/letter_avatar/anon2538481/32/6_449c533f586939b6e5f246632a46421f.png) [@anon2538481](https://forum.infinityfree.com/u/anon2538481)\
**Post date:** [March 13, 2020, 12:32am UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977/3 "2020-03-13T00:32:01Z")

</div>

Not

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [March 13, 2020, 7:02pm UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977/4 "2020-03-13T19:02:18Z")

</div>

I checked your website, but the actual .htaccess file on it is different from what you shared here. And if I read the line correctly, it will cause any request which is sent over HTTP to be redirected to HTTP.

And that, of course, will cause a redirect loop.

What did you intend to achieve with the .htaccess rules currently there? If you could explain that, maybe we can help you find or write rules which do what you need?

---

<div class="post-metadata">

**Author:** ![anon2538481](https://forum.infinityfree.com/letter_avatar/anon2538481/32/6_449c533f586939b6e5f246632a46421f.png) [@anon2538481](https://forum.infinityfree.com/u/anon2538481)\
**Post date:** [March 23, 2020, 9:59pm UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977/5 "2020-03-23T21:59:06Z")

</div>

I would like it to redirect to my index.php

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [March 24, 2020, 3:43pm UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977/6 "2020-03-24T15:43:42Z")

</div>

Hmm, looking at your .htaccess rules, I think this might be the issue:

```auto
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

```

I think this should be:

```auto
RewriteRule ^(.+)$ /index.php?url=$1 [QSA,L]

```

If you don’t include the slash, the server may try to look for an index.php file in the directory you’re trying to access, rather than the one at the root of the website.

---

<div class="post-metadata">

**Author:** ![anon2538481](https://forum.infinityfree.com/letter_avatar/anon2538481/32/6_449c533f586939b6e5f246632a46421f.png) [@anon2538481](https://forum.infinityfree.com/u/anon2538481)\
**Post date:** [March 29, 2020, 3:23pm UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977/7 "2020-03-29T15:23:40Z")

</div>

I changed it, but it has the same error

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [March 30, 2020, 2:33pm UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977/8 "2020-03-30T14:33:10Z")

</div>

I just checked your website, and I don’t think the .htaccess rules are the problem. Because even after I disabled all the rules, I still got a redirect error.

Can you please check whether your PHP code does any redirects? If so, those are likely responsible for the redirect loop issue?

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [April 29, 2020, 2:35pm UTC](https://forum.infinityfree.com/t/err-too-many-redirects/26977/9 "2020-04-29T14:35:35Z")

</div>

Closed on April 29, 2020, 2:35pm UTC

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