Re: Re: run a script for any HTTP request (was: run a script on access to a directory)
| From: | Geoff Caplan | Date: | Sat, 08 Sep 2001 09:41:59 +0000 |
| Subject: | Re: Re: run a script for any HTTP request (was: run a script on access to a directory) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66521@lists.php.net to get a copy of this message | ||
Enrique
> On Fri, 7 Sep 2001, Enrique Vadillo wrote:
> > 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 do this all the time - it offers all kinds of advantages.
This link explains why and how to do this
http://www.phpbuilder.com/columns/tim20000526.php3
My own appoach is to use Apache mod_rewrite to direct all requests to my
"main" script, but leave one directory free for conventional .html or .php
files. You need something like this in your Apache configuration -
RewriteEngine on
RewriteRule !^/my_conventional_directory(.*) /my_main_file.php [nocase]
This means: "if request is not for my conventional directory, run my main
script"
Cheers
Geoff Caplan