Kimberly Mullins
Kimberly Mullins

Reputation: 101

Error 310 (net::ERR_TOO_MANY_REDIRECTS):

What is this error:

Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

I use PHP CodeIgniter and library SimpleLoginSecure, this is my code:

if ($this->session->userdata('logged_in')) {
    redirect('admin/index');
}

How can I resolve this error?

Regards

Upvotes: 4

Views: 37326

Answers (5)

ntthushara
ntthushara

Reputation: 351

check maybe you loading "index" page again somewhere in your code when the index page loading.

redirect('admin/index');

Upvotes: 0

jamesxu-e.g.
jamesxu-e.g.

Reputation: 650

You should not use redirect() function in your class's __construct().

Upvotes: 1

kristina childs
kristina childs

Reputation: 2210

I just ran into this with a blog I manage and it ended up being a problem with the URLs set in wp_options. We moved the domain of the dev server and while one of domain prefix changes took in the database, the other didn't. If your url is set for http://domain.com, try setting it to http://www.domain.com.

Just goes to show it always helps to start with double-checking your settings, both in wp-config.php and the db site settings.

Upvotes: 0

Joel Hernandez
Joel Hernandez

Reputation: 2213

My solution:

$self    = $_SERVER['PHP_SELF'];
$str2use = strrchr($self, '/');
$length  = strlen($str2use) -1;
@$fname  = substr($str2use, 1, $length);

if ($fname != "YOURPHPSCRIPT.php"){
    echo "<script>window.location='YOURPHPSCRIPT.php';</script>";
    exit;
}  

Upvotes: 0

Richard H
Richard H

Reputation: 39055

I'm guessing you get an infinite redirect loop: you get redirected to admin/index, this same code snippet is run again, redirecting to admin/index ad infinitum. You probably want to add a check to that snippet and only do the redirect if you're NOT on the admin/index page.

Upvotes: 9

Related Questions