run a script for any HTTP request (was: run a script on access to a directory)
| From: | Enrique Vadillo | Date: | Fri, 07 Sep 2001 20:49:41 +0000 |
| Subject: | run a script for any HTTP request (was: run a script on access to a directory) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-66473@lists.php.net to get a copy of this message | ||
That was a fine idea Doug, but what if we push the subject and
go a little further?
I am thinking now that i'd like to make it possible that for
ANY http request received by my Apache i'd like to have a php
script executed first, i.e.:
http://domain.com/
http://domain.com/anydir/anyfile
for any of those locations typed, i'd like to be able to
execute the php script. i know it's kinda weird but this is
what i'm really looking for. any ideas anyone?
Enrique-
From: "Doug Granzow" <dig@cynosure.net> To: php-general@lists.php.net Subject: [PHP] Re: execute a script on access to a directory Date: Fri, 7 Sep 2001 15:38:45 -0400 You can make "go" the name of your PHP script, then put this in your Apache config: <Location /go>_________________________________________________________________ Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.aspForceType application/x-httpd-php</Location> Now in your "go" script, you have it do whatever you wanted it to do, then use an include to load the "getit" script. Doug Granzow dig@cynosure.net <enrique_vadillo@hotmail.com> wrote: Hi, I would like to know how i can force a PHP script to be executed everytime a certain directory is accessed, for example in http://domain.com/go/getit the presence of the /go/ directory would force a PHP script to be executed prior to any operation. Do i need to play with rewriting urls in Apache or is there any other cleaner method (that would not require rewriting URLs) to achieve this? i'd hate to have to rewrite URLs... thanks.