Next: NCSA server directives
Up: Mapping directives
Previous: Mapping directives
The CERN server uses a set of rules for mapping from a URL in an HTTP
request to a physical file. The rules are applied in the order they
appear in the configuration file until a request has been explicitly
accepted or rejected, or there are no more rules to apply.
The URL in the HTTP request forms the initial request string. The
rules specify pattern templates, against which the request string is
matched. The Map, Pass, Exec and Redirect
rules also specify a replacement template, which may be substituted
for all or part of the original string (the replacement template is
optional for the Pass directive). Asterisks are used as
wildcards in the pattern templates, to match substrings in the request
string. If matches are found the request string is replaced with the
contents of the replacement template. Where the replacement template
contains asterisks, the corresponding substrings of the original
request string are retained. The following set of mapping rules
illustrates some of the possibilities:
Map /misc/* /disk2/misc/* # 1
Fail /disk2/misc/new/* # 2
Pass /disk2/misc/part1/* /disk2/part1/* # 3
Redirect /disk2/misc/part2/* http://othersite.org/temp/* # 4
Pass /disk2/misc/part3/* # 5
In the example above:
- A request with a URL of /misc/new/doc.html, by virtue of
rule 1, will be mapped to /disk2/misc/new/doc.html and then
rejected by rule 2.
- A request with a URL of /misc/part1/doc.html will be
mapped to /disk2/misc/part1/doc.html by rule 1 and then
accepted by rule 3 and simultaneously mapped to
/disk2/part1/doc.html.
- A request with a URL of /misc/part2/doc.html will be
mapped to /disk2/misc/part2/doc.html by rule 1 and then
redirected to the server othersite.org by rule 4.
- A request with a URL of /misc/part3/doc.html will be
mapped to /disk2/misc/part3/doc.html by rule 1 and then
accepted without further remapping by rule 5.
- A request with a URL of /misc/part4/doc.html will be
mapped to /disk2/misc/part4/doc.html by rule 1 and then,
as it matches no further rules, accepted if that file exists.
Map pattern replacement
Maps request strings that match the pattern template according to the
replacement template.
Map /misc/* /disk2/misc/*
There is no equivalent NCSA directive.
Pass pattern [replacement]
If the current request string matches the specified pattern, it is
accepted and further mapping rules are ignored. If a
replacement is specified, the part of the request string
matching the pattern is replaced with the replacement:
Pass /depts/sales/*
Pass /depts/sales/* /usr/depts/sales/*
Analogous to the NCSA Alias directive.
Fail pattern
If the current request string matches the specified pattern, it is
rejected. All further mapping rules are ignored.
Fail /depts/sales/confidential/*
There is no equivalent NCSA directive.
Redirect pattern replacement
If the current request string matches the specified pattern, the request is
redirected to another server.
Redirect /sales/* http://othersite.org/usr/depts/sales/*
Equivalent to the NCSA Redirect directives.
Next: NCSA server directives
Up: Mapping directives
Previous: Mapping directives
Spinning the Web by Andrew Ford
© 1995 International Thomson Publishing
© 2002 Andrew Ford and Ford & Mason Ltd
Note: this HTML document was generated in December 1994 directly from the
LaTeX source files using LaTeX2HTML. It was formatted into our standard page layout
using the Template Toolkit. The document is mainly of historical
interest as obviously many of the sites mentioned have long since
disappeared.
|