Redirect Context

Table of Contents

Redirect Context

URI | 外部重定向 | 状态码 | 目标URI | Header Operations | Realm | 认证名称 | Require(授权的用户/组) | 允许访问列表 | 拒绝访问列表 | Authorizer

Redirect Context

Description

A Redirect Context can be used to forward one URI or a group of URIs to another location. The destination URI can be either on the same web site (an internal redirect) or an absolute URI pointing to another web site (an external redirect).

URI

Description

Specifies the URI for this context.

Syntax

The URI can be a plain URI (starting with "/") or a Perl compatible regular expression URI (starting with "exp:"). If a plain URI ends with a "/", then this context will include all sub-URIs under this URI. If the context maps to a directory on the file system, a trailing "/" must be added.

See Also

Location

外部重定向

Description

指定重定向是否为外部重定向。 对于外部重定向,可以指定状态码以及 目标URI可以以"/"或"http(s): //"开头。 对于内部重定向,目标URI必须以"/"开头。

状态码

Description

指定外部重定向响应状态码。 如果状态码在300和399之间,可以指定目标URI

Syntax

选择

目标URI

Description

指定重定向的目标位置。 如果被重定向的URI映射到另一个重定向URI时,将再次被重定向。

Syntax

这个URI可以是一个在同一个网站上以"/"开始的相对URI, 或者是一个指向其他网站以"http(s): //"开始的绝对URI。 如果URI包含正则表达式,目标地址可以匹配变量,如$1或$2。

Header Operations

Description

Specifies additional response/request headers to be added. Multiple header directives can be added with one directive per line. "NONE" can be used to disable parent header inheritance. If no directive is provided 'Header' is assumed.

Syntax

[Header]|RequestHeader [condition] set|append|merge|add|unset header [value] [early|env=[!]variable]

Example

set Cache-control no-cache
append Cache-control no-store
Header set My-header cust_header_val
RequestHeader set My-req-header cust_req_header_val

Tips

Syntax and usage are similar to Apache's mod_headers directives for supported operations.

The 'Header' directive is is optional and can be excluded or left in when copying rules from elsewhere without issue.

Realm

Description

指定这个context下的realm授权。 当指定时,必须提供有效的用户和用户名来访问这个context。 Realms授权需要在Virtual Host Security部分进行设置。此设置使用每个realm的Realm名称

Syntax

选项

认证名称

Description

为当前context下的realm认证指定一个替代的名称。 如果没有指定,原realm名称将被使用。 认证名称将显示在浏览器登陆弹出窗口。

Syntax

文本

Require(授权的用户/组)

Description

指定哪些用户/用户组可以访问此context。 这里允许你使用一个用户/组数据库(在 Realm中指定)访问多个context, 但只允许该数据库下特定的用户/组访问这个context。

Syntax

语法兼容Apache的Require指令。例如:

  • user username [username ...]
    只有列出的用户可以访问这个context;
  • group groupid [groupid ...]
    用户必须属于列出的组才可以访问这个context。
如果没有指定,所有有效的用户都可以访问这个资源。

允许访问列表

Description

指定允许访问这个context下资源的IP地址或子网。综合 拒绝访问列表项的配置以及服务器/虚拟主机级别访问控制, 可访问性将以客户端IP所符合的最小范围来确定。

Syntax

逗号分隔的IP地址/子网列表。

Example

子网络可以写成192.168.1.0/255.255.255.0, 192.168.1192.168.1.*

拒绝访问列表

Description

指定哪个IP地址或子网不被允许访问这个context下的资源。 综合允许访问列表项的配置以及服务器/虚拟主机级别访问控制, 可访问性将以客户端IP所符合的最小范围来确定。

Syntax

逗号分隔的IP地址/子网列表。

Example

子网络可以写成192.168.1.0/255.255.255.0, 192.168.1192.168.1.*

Authorizer

Description

Specifies an external application that can be used to generate authorized/unauthorized decisions. Currently, only the FastCGI Authorizer is available. For more details about the FastCGI Authorizer role, please visit http://www.fastcgi.com.

Syntax

Select from drop down list