1 Answer
1

What's happening is you're sending an unauthenticated visitor to a certain page. The code in that page also picks up that the user is unauthenticated, and sends them to the page that they're already on. Because the page keeps on sending the visitor to the same page, the visitor can't go anywhere. This is called a redirect loop.

You're on the right track with the $_SERVER['REQUEST_URI'] check. However, paths like ../ and .../ won't work. You need to use the actual URL of the page that you're redirecting to (sans the domain and protocol). Essentially, you need to use this code: