Page 1 of 1
$_SESSION and .htaccess
Posted: Sun Jan 02, 2005 1:05 pm
by Gen-ik
Hi guys.
Does anyone know if it's possible to access $_SESSION variables in a .htacess file?
Si ++
Posted: Mon Jan 03, 2005 7:02 am
by n00b Saibot
I think it's not

Posted: Mon Jan 03, 2005 7:09 am
by Gen-ik
I didn't think so either because .htaccess files are run before any PHP files, I just wanted to make sure though... just in case

Posted: Mon Jan 03, 2005 7:24 am
by n00b Saibot
more so, because .htaccess is Apache's thing and $_SESSION is PHP's one. both are widely different thngs.

Posted: Mon Jan 03, 2005 8:28 am
by feyd
what information are you trying to access in the session data?
Posted: Mon Jan 03, 2005 9:12 am
by Gen-ik
feyd wrote:what information are you trying to access in the session data?
It would be custom stuff really... $_SESSION["foobar"] and so on... although as far as I know it's not going to be possible.
Posted: Mon Jan 03, 2005 10:24 am
by feyd
yeah, it would seem not exactly, or directly possible. come to think of it, there may be a chance to do some fiddling (depending on what you want to do with the information) using the rewrite engine. I remember being able to call an external script for rewrite controls..

Posted: Mon Jan 03, 2005 11:17 am
by Gen-ik
feyd wrote:yeah, it would seem not exactly, or directly possible. come to think of it, there may be a chance to do some fiddling (depending on what you want to do with the information) using the rewrite engine. I remember being able to call an external script for rewrite controls..

Hmm, that's actually quite interesting. I also remember the Apache docs mentioning something about loading external files into a .htaccess file... so, the question is can that file be generated by PHP (even if it involves PHP spitting out a plain/txt header or something).
I might do a bit of experimenting with it tonight

Posted: Mon Jan 03, 2005 11:48 am
by feyd
I know I could call a php script through the rewrite engine.. although I never tried using the superglobals during that experiment..