Execute CGI (or FastCGI or PHP) on missing target file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

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:

template.cgi
index.tmpl
shops.tmpl

specialcase.html
anotherspecial.php
morespecial.cgi

-----

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 present.

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.

TIA

Tim

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux