The rewrite function allows flexible mappings between URIs and file system paths.
The following table describes parameters for the rewrite function.
Table 7–13 rewrite Parameters
Parameter |
Description |
---|---|
(Optional) Wildcard pattern that specifies the path of requests that should be rewritten. The default is to match all paths. |
|
root |
(Optional) File system path to the effective root document directory. |
name |
(Optional) Name of an object in obj.conf whose directives will be applied to this request. |
path |
(Optional) Rewritten partial path. If non-empty, the path must begin with a slash (/). |
bucket |
(Optional) Common to all obj.conf functions. Adds a bucket to monitor performance. For more information, see The bucket Parameter. |
The following obj.conf code maps requests for the URI /~user/index.html to the file system path /home/user/public_html/index.html:
<If $path =~ "^/~([^/]+)(|/.*)$"> NameTrans fn="rewrite" root="/home/$1/public_html" path="$2" </If>