pfx2dir
Applicable in NameTrans-class directives.
The pfx2dir function replaces a directory
prefix in the requested URL with a real directory name. It also optionally
enables you to specify the name of an object that matches the current
request. See the discussion of assign-name for
details of using named objects.
Parameters
The following table describes parameters for the pfx2dir function.
Table 5–48 pfx2dir parameters
Parameter
|
Description
|
from
|
URI prefix to convert. Do not insert a trailing slash (/).
|
dir
|
Local file system directory path that the prefix is converted
to. Do not insert a trailing slash (/).
|
name
|
(Optional) Specifies an additional named object in obj.conf whose directives will be applied to this request.
|
find-pathinfo-forward
|
(Optional) Makes the server look for the PATHINFO forward
in the path after the ntrans-base instead of backward from
the end of path as the server function find-pathinfo does
by default.
The value you assign to this parameter is ignored. If you do
not want to use this parameter, do not include it.
The find-pathinfo-forward parameter is ignored
if the ntrans-base parameter is not set in rq->vars when the server function find-pathinfo is
called. By default, ntrans-base is set.
This feature can improve performance for certain URLs by reducing
the number of stats performed in the server function find-pathinfo.
On Windows, this feature can also be used to prevent the PATHINFO from the server URL normalization process (changing ’\\’
to ’/’) when the PathCheck server function find-pathinfo is used. Some double-byte characters have
hexadecimal values that may be parsed as URL separator characters
such as \\ or ~. Using the find-pathinfo-forward parameter
can sometimes prevent incorrect parsing of URLs containing double-byte
characters.
|
bucket
|
(Optional) Common to all obj.conf functions.
|
Examples
In the first example, the URL http://server-name/cgi-bin/resource (such as http://x.y.z/cgi-bin/test.cgi)
is translated to the physical path name /httpd/cgi-local/resource (such as /httpd/cgi-local/test.cgi),
and the server also starts processing the directives in the object
named cgi.
NameTrans fn=pfx2dir from=/cgi-bin dir=/httpd/cgi-local name=cgi
|
In the second example, the URL http://server-name/icons/resource (such
as http://x.y.z/icons/happy/smiley.gif) is translated
to the physical path name /users/nikki/images/resource (such as /users/nikki/images/smiley.gif).
NameTrans fn=pfx2dir from=/icons/happy dir=/users/nikki/images
|
The third example shows the use of the find-pathinfo-forward parameter. The URL http://server-name/cgi-bin/resource is
translated to the physical path name /export/home/cgi-bin/resource.
NameTrans fn="pfx2dir" find-pathinfo-forward="" from="/cgi-bin"
dir="/export/home/cgi-bin" name="cgi"
|