DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 5.6 Mapping Several URLs to the Same CGI Directory

Problem

You want to have a number of URLs map to the same CGI directory but don't want to have multiple ScriptAlias directives.

Solution

Use ScriptAliasMatch in httpd.conf to match against a regular expression:

ScriptAliasMatch ^/([sS]cripts?|cgi(-bin)?)/ /www/cgi-bin/

Discussion

This is a more complicated recipe than the previous one and may require that you read Appendix A. This directive maps requests starting with /script/, /scripts/, /Script/, /Scripts/, /cgi/, and /cgi-bin/ to the directory /www/cgi-bin/, and it causes all files in that directory to be treated as CGI programs.

This kind of directive is generally used to clean up a mess that you have made. If you design your web site well from the start, this sort of thing is never necessary, but the first time you redesign, or otherwise rearrange your web site, you'll find the necessity for these sorts of contortions.

See Also

    [ Team LiB ] Previous Section Next Section