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

  • Recipe 5.5

  • Appendix A



Apache Cookbook
Apache Cookbook: Solutions and Examples for Apache Administrators
ISBN: 0596529945
EAN: 2147483647
Year: 2006
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net