executing scripts inside htaccess

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

hi all,
is there a way to excute a script from htaccess for all urls? for
example, if a page is accessed, can htaccess run sendmail, emailing the
info, and then continue?

obviously that's what log files are for, but it's useful if one doesn't
have the logs and wants to see access stats to a small folder for a
couple of days.


Re: executing scripts inside htaccess

On 21 Apr 2006 12:59:10 -0700, rhashemian@hotmail.com wrote:

Quoted text here. Click to load it

No. .htaccess files are simply configuration files for the Apache web

You could perhaps put a server-side-included CGI program into every
page to execute the commands you wish.


Veritas Vincti

Re: executing scripts inside htaccess

thanks for the reply and you are correct, but i found a way for this
using mod_rewrite. mod_rewrite is an awesome work of art.

in a nutshell, every time a user accesses a file in the folder,
mod_rewrite intercepts it and quietly rewrites the url to a php page
passing the filename along as a querystring parameter.

the php script sends the email, and streams that particular file back
to the user. no url changes, no redirects, and the user has a smooth
experience, noticing nothing.

http://www.hashemian.com /

Site Timeline