What Causes A Redirect Loop?
Here are my pages:

Redirect Page:
if user has an open session, redirect to the proper resource
else redirect to login page

Login Page:
if user login info is valid, redirect to $_SERVER['HTTP_REFERER']
else display login page

When you visit the redirect page, it sees that you do not have a valid session and redirects to the login page. You can then login no problems, but after authentication I receive the "This webpage has a redirect loop." page in Chrome.

It's not a true loop, since there are several ways out (IE provide valid login details and go to destination resource, provide invalid login and receive error message, etc). But I can see the browser's confusion (going from a to b to a again).

Any ideas how I can solve this problem?

Cheers
What Causes A Redirect Loop?
===

Here are my pages:

Redirect Page:
if user has an open session, redirect to the proper resource
else redirect to login page

Login Page:
if user login info is valid, redirect to $_SERVER['HTTP_REFERER']
else display login page

When you visit the redirect page, it sees that you do not have a valid session and redirects to the login page. You can then login no problems, but after authentication I receive the "This webpage has a redirect loop." page in Chrome.

It's not a true loop, since there are several ways out (IE provide valid login details and go to destination resource, provide invalid login and receive error message, etc). But I can see the browser's confusion (going from a to b to a again).

Any ideas how I can solve this problem?

Cheers