httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Watts>
Subject [users@httpd] Execute CGI (or FastCGI or PHP) on missing target file
Date Thu, 08 Jul 2010 10:09:50 GMT

Sorry if this has been coverned - tried a few searches on google and 
this list's archives to no avail.

I'd like to move my server over to a templating system.

Specifically, what I'd like to do is to be able to execute one named CGI 
(probably under FastCGI) where Apache cannot find an existing target 
file (ideally with named extensions like .html but that's not so 
important) after URL-path translation phase.

eg /var/www/ contains:




requests to the webserver should handled thus:

http(s)://webserver/index.html -> template.cgi
http(s)://webserver/shops.html -> template.cgi
http(s)://webserver/wibble.html -> template.cgi
http(s)://webserver/specialcase.html -> specialcase.html
http(s)://webserver/anotherspecial.php -> anotherspecial.php
http(s)://webserver/morespecial.cgi -> morespecial.cgi

This will allow template.cgi to look at the request and decide if the 
request was X.html and X.tmpl exists, to run template.cgi on X.tmpl. 
template.cgi will handle the error page when required.

Special cases exceptions can be handled just by having the target file 

I'll also need to ideally have this work on any sub path too

http(s)://webserver/wibble/index.html -> template.cgi
http(s)://webserver/wibble/special.html -> wibble/special.html if 
wibble/special.html exists

with an easy way to disable it en-bloc for certain paths.

Sounds like a rewrite rule, but I've always struggled with those and 
really don't know how to attack this.

Any pointers, even "google for blah" would be most appreciated.



The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message