ERR_TOO_MANY_REDIRECTS - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: ERR_TOO_MANY_REDIRECTS (/showthread.php?tid=71716) |
ERR_TOO_MANY_REDIRECTS - davidblack - 09-16-2018 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 My htaccess is: Code: #<IfModule mod_rewrite.c> Can you hel me? Thanks RE: ERR_TOO_MANY_REDIRECTS - InsiteFX - 09-16-2018 That's because the way you are doing it is sending your controller into a never ending loop. Send them to an error page or something else. IF it is a login auth system then check to see if they are logged in and if not send them to your login page. RE: ERR_TOO_MANY_REDIRECTS - davidblack - 09-16-2018 (09-16-2018, 09:08 AM)InsiteFX Wrote: That's because the way you are doing it is sending your controller into a never ending loop. Ok. But how i do it? usin "redirect" again? Thanks RE: ERR_TOO_MANY_REDIRECTS - InsiteFX - 09-16-2018 It's hard to try and help you when you do not give us the information we need. What auth system are you using etc; ? RE: ERR_TOO_MANY_REDIRECTS - davidblack - 09-16-2018 (09-16-2018, 11:15 AM)InsiteFX Wrote: It's hard to try and help you when you do not give us the information we need. Thanks!!! My sistem is CodeIgniter 3.1.9. i think that if i use "redirect" i nte constructor fo de class i always get de same error. you say me to redirect to a view? like this? Code: class inicio extends CI_Controller RE: ERR_TOO_MANY_REDIRECTS - InsiteFX - 09-17-2018 If it is an auth system then you would want them to be sent to a login view. |