Sun Java System Web Server 7.0 Update 8 Administrator's Configuration File Reference

redirect

The redirect function lets you change URLs and send the updated URL to the client. When a client accesses your server with an old path, the server treats the request as a request for the new URL.

The redirect function inspects the URL to which the client will be redirected. If the URL matches the URL the client has requested (same scheme, hostname, port, and path), this function does not perform the redirect and instead returns REQ_NOACTION.

Parameters

The following table describes parameters for the redirect function.

Table 7–113 redirect Parameters

Parameter 

Description 

from

(Optional) Specifies the prefix of the requested URI to match. If from is not specified, it defaults to "".

url

(Optional) Specifies a complete URL to return to the client. If you use this parameter, do not use url-prefix.

url-prefix

(Optional) The new URL prefix to return to the client. The from prefix is replaced by this URL prefix. If you use this parameter, do not use url.

escape

(Optional) Indicates whether the value of the url or url-prefix parameter needs to be escaped. The default is yes, indicating that the server will escape the value. The value no indicates that the URL or URL prefix value has already been escaped. An example of an escaped value is one where any % characters have been replaced with %25 and any spaces have been replaced with %20.

For more information about escaping URIs, see the description of util_uri_escape, in the Sun Java System Web Server 7.0 Update 8 NSAPI Developer’s Guide.

status

(Optional) Customizes the HTTP status code. If status is not specified, it defaults to 302.

type

(Optional) Common to all Output-class functions. Specifies a wildcard pattern of MIME types for which this function will be executed.

method

(Optional) Common to all Output-class functions. Specifies a wildcard pattern of HTTP methods for which this function will be executed. Common HTTP methods are GET, HEAD, and POST.

query

(Optional) Common to all Output-class functions. Specifies a wildcard pattern of query strings for which this function will be executed.

bucket

(Optional) Common to all obj.conf functions. Adds a bucket to monitor performance. For more information, see The bucket Parameter.

Example

In the first example, any request for http://server-name/whatever is translated to a request for http://tmpserver/whatever.

NameTrans fn="redirect" from="/" url-prefix="http://tmpserver/"

In the second example, any request for http://server-name/toopopular/whatever is translated to a request for http://bigger/better/stronger/morepopular/.

NameTrans fn="redirect" from="/toopopular" 
     url="http://bigger/better/stronger/morepopular"

See Also

restart