Welcome Guest, Not a member yet? Register   Sign In
ERR_TOO_MANY_REDIRECTS
#1

Hello,

I use codeigniter 3 and I'm trying to prevent an unregistered user from accessing any function of a controller. To do this in the contructor I check if the session variable "name" is defined and if it is not I do a "redirect" to the base_url().

If this variable is not defined I redirect with "redirect" to the base_url. But what I get is an error: "ERR_TOO_MANY_REDIRECTS".

Code:
class inicio extends CI_Controller
    {

        function __construct()
        {
            parent::__construct();
            $this->load->model("usuarios_modelo");


            if(!$this->session->userdata("nombre"))
            {

                    redirect(base_url());

            }
        }

My htaccess is:

Code:
#<IfModule mod_rewrite.c>

# RewriteEngine on
# RewriteCond $1 !^(index\.php)
# RewriteRule ^(.*)$ index.php/$1 [L]

#</IfModule>

<IfModule mod_rewrite.c>

# allow_override On
# mod_rewrite is installed

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

</IfModule>


Can you hel me?

Thanks
Reply


Messages In This Thread
ERR_TOO_MANY_REDIRECTS - by davidblack - 09-16-2018, 02:09 AM
RE: ERR_TOO_MANY_REDIRECTS - by InsiteFX - 09-16-2018, 09:08 AM
RE: ERR_TOO_MANY_REDIRECTS - by davidblack - 09-16-2018, 10:04 AM
RE: ERR_TOO_MANY_REDIRECTS - by InsiteFX - 09-16-2018, 11:15 AM
RE: ERR_TOO_MANY_REDIRECTS - by davidblack - 09-16-2018, 04:11 PM
RE: ERR_TOO_MANY_REDIRECTS - by InsiteFX - 09-17-2018, 03:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB