Forum Moderators: phranque
If someone accesses www.domain.com/test/dir/ directly, they must log in, but since they are not going via the index.php in the parent directory accesses are not logged by my script.
What I want to do is have visitors entering directly via www.domain.com/test/dir/ to be redirected to www.domain.dir/test/ if they are not already authenticated.
Is there a way to do this via .htaccess, without getting an endless loop?
The PHP script at The www.domain.com/test/index.php is there to track hits, and then redirect to the appropriate directory based on the $_SERVER['PHP_AUTH_USER'] variable. The script does not do any authentication itself, all that is done by Apache.
What I'm trying to do is redirect them back to the script at www.domain.com/test/index.php if they attempt to login directly via www.domain.com/test/dir/ or any other directory under www.domain.com/test/
Sorry for being long-winded, it's sort of hard to explain :)