File: //usr/local/lsws/docs/zh-CN/Redirect_Context.html
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Open LiteSpeed Web Server Users' Manual - Redirect Context</title>
<meta name="description" content="Open LiteSpeed Web Server Users' Manual - Redirect Context." />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex">
<link rel="shortcut icon" href="../img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="../css/hdoc.css">
</head>
<body>
<div class="pagewrapper clearfix"><aside class="sidetree ls-col-1-5">
<figure>
<img src="img/ols_logo.svg" alt="openlitespeed logo" width="150px"/>
</figure>
<h3 class="ls-text-thin">OpenLiteSpeed Web Server <a href="index.html"> Users' Manual</a></h3>
<h5 class="ls-text-muted">Version 1.6 — Rev. 2</h5>
<hr/>
<div>
<ul>
<li><a href="license.html">License</a></li>
<li><a href="intro.html">Introduction</a></li>
<li><a href="install.html">Installation</a></li>
<li>
<a href="admin.html">Administration</a>
<ul class="level2">
<li><a href="ServerStat_Help.html">Service Manager</a></li>
</ul>
</li>
<li><a href="security.html">Security</a></li>
<li>
<a href="config.html">Configuration</a>
<ul class="level2">
<li><a href="ServGeneral_Help.html">Server General</a></li>
<li><a href="ServLog_Help.html">Server Log</a></li>
<li><a href="ServTuning_Help.html">Server Tuning</a></li>
<li><a href="ServSecurity_Help.html">Server Security</a></li>
<li><a href="ExtApp_Help.html">External Apps</a></li>
<ul class="level3">
<li><a href="External_FCGI.html">Fast CGI App</a></li>
<li><a href="External_FCGI_Auth.html">Fast CGI Authorizer</a></li>
<li><a href="External_LSAPI.html">LSAPI App</a></li>
<li><a href="External_Servlet.html">Servlet Engine</a></li>
<li><a href="External_WS.html">Web Server</a></li>
<li><a href="External_PL.html">Piped logger</a></li>
<li><a href="External_LB.html">Load Balancer</a></li>
</ul>
<li><a href="ScriptHandler_Help.html">Script Handler</a></li>
<li><a href="App_Server_Help.html">App Server Settings</a></li>
<li><a href="Module_Help.html">Module Configuration</a></li>
<li><a href="Listeners_General_Help.html">Listener General</a></li>
<li><a href="Listeners_SSL_Help.html">Listener SSL</a></li>
<li><a href="Templates_Help.html">Virtual Host Templates</a></li>
<li><a href="VirtualHosts_Help.html">Virtual Host Basic</a></li>
<li><a href="VHGeneral_Help.html">Virtual Host General</a></li>
<li><a href="VHSecurity_Help.html">Virtual Host Security</a></li>
<li><a href="VHSSL_Help.html">Virtual Host SSL</a></li>
<li><a href="Rewrite_Help.html">Rewrite</a></li>
<li><a href="Context_Help.html">Context</a></li>
<ul class="level3">
<li><a href="Static_Context.html">Static Context</a></li>
<li><a href="Java_Web_App_Context.html">Java Web App Context</a></li>
<li><a href="Servlet_Context.html">Servlet Context</a></li>
<li><a href="FCGI_Context.html">Fast CGI Context</a></li>
<li><a href="LSAPI_Context.html">LSAPI Context</a></li>
<li><a href="Proxy_Context.html">Proxy Context</a></li>
<li><a href="CGI_Context.html">CGI Context</a></li>
<li><a href="LB_Context.html">Load Balancer Context</a></li>
<li><span class="current"><a href="Redirect_Context.html">Redirect Context</a></span></li>
<li><a href="App_Server_Context.html">App Server Context</a></li>
<li><a href="Module_Context.html">Module Handler Context</a></li>
</ul>
<li><a href="VHWebSocket_Help.html">Web Socket Proxy</a></li>
</ul>
</li>
<li><a href="webconsole.html">Web Console</a>
<ul class="level2">
<li><a href="AdminGeneral_Help.html">Admin Console General</a></li>
<li><a href="AdminSecurity_Help.html">Admin Console Security</a></li>
<li><a href="AdminListeners_General_Help.html">Admin Listener General</a></li>
<li><a href="AdminListeners_SSL_Help.html">Admin Listener SSL</a></li>
</ul>
</li>
</ul>
</div>
</aside>
<article class="contentwrapper ls-col-3-5 clearfix"><div class="nav-bar ls-spacer-micro-top"><div class="prev">« <a href="LB_Context.html">Load Balancer Context</a></div><div class="center"><a href="Context_Help.html">Context</a></div><div class="next"><a href="App_Server_Context.html">App Server Context</a> »</div></div>
<h1>Redirect Context</h1><h2 id="top">Table of Contents</h2><section class="toc"><section class="toc-row"><header><a href="#redirectContext">Redirect Context</a></header><p>
<a href="#expuri">URI</a> | <a href="#externalredirect">外部重定向</a> | <a href="#statuscode">状态码</a> | <a href="#destinationuri">目标URI</a> | <a href="#extraHeaders">Header Operations</a> | <a href="#realm">Realm</a> | <a href="#authName">认证名称</a> | <a href="#required">Require(授权的用户/组)</a> | <a href="#accessAllowed">允许访问列表</a> | <a href="#accessDenied">拒绝访问列表</a> | <a href="#extAuthorizer">Authorizer</a></p></section>
</section>
<section><div class="helpitem"><article class="ls-helpitem"><div><header id="redirectContext"><h3>Redirect Context<span class="ls-permlink"><a href="#redirectContext"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>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).</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="expuri"><h3>URI<span class="ls-permlink"><a href="#expuri"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>Specifies the URI for this context.</p> <h4>Syntax</h4><p>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.</p> <h4>See Also</h4><p class="ls-text-small"><span class="tagl"><a href="#location">Location</a></span></p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="externalredirect"><h3>外部重定向<span class="ls-permlink"><a href="#externalredirect"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定重定向是否为外部重定向。 对于外部重定向,可以指定<span class="tagl"><a href="#statuscode">状态码</a></span>以及 <span class="tagl"><a href="#destinationuri">目标URI</a></span>可以以"/"或"http(s): //"开头。 对于内部重定向,<span class="tagl"><a href="#destinationuri">目标URI</a></span>必须以"/"开头。</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="statuscode"><h3>状态码<span class="ls-permlink"><a href="#statuscode"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定外部重定向响应状态码。 如果状态码在300和399之间,可以指定<span class="tagl"><a href="#destinationuri">目标URI</a></span>。</p> <h4>Syntax</h4><p>选择</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="destinationuri"><h3>目标URI<span class="ls-permlink"><a href="#destinationuri"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定重定向的目标位置。 如果被重定向的URI映射到另一个重定向URI时,将再次被重定向。</p> <h4>Syntax</h4><p>这个URI可以是一个在同一个网站上以"/"开始的相对URI, 或者是一个指向其他网站以"http(s): //"开始的绝对URI。 如果<span class="tagl"><a href="#expuri">URI</a></span>包含正则表达式,目标地址可以匹配变量,如$1或$2。</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="extraHeaders"><h3>Header Operations<span class="ls-permlink"><a href="#extraHeaders"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>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.</p> <h4>Syntax</h4><p>[Header]|RequestHeader [condition] set|append|merge|add|unset header [value] [early|env=[!]variable]</p> <h4>Example</h4><div class="ls-example">set Cache-control no-cache<br/> append Cache-control no-store<br/> Header set My-header cust_header_val<br/> RequestHeader set My-req-header cust_req_header_val</div><h4>Tips</h4><p><span title="Information" class="ls-icon-info"></span> Syntax and usage are similar to <a href="https://httpd.apache.org/docs/2.2/mod/mod_headers.html#header" target="_blank" rel="noopener noreferrer">Apache's mod_headers directives</a> for supported operations.<br/><br/> <span title="Information" class="ls-icon-info"></span> The 'Header' directive is is optional and can be excluded or left in when copying rules from elsewhere without issue.</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="realm"><h3>Realm<span class="ls-permlink"><a href="#realm"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定这个context下的realm授权。 当指定时,必须提供有效的用户和用户名来访问这个context。 <span class="tagl"><a href="VHSecurity_Help.html#realms">Realms授权</a></span>需要在<span class="tagP"><a href="#VHSecurity_Help">Virtual Host Security</a></span>部分进行设置。此设置使用每个realm的<span class="tagl"><a href="VHSecurity_Help.html#realmName">Realm名称</a></span>。</p> <h4>Syntax</h4><p>选项</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="authName"><h3>认证名称<span class="ls-permlink"><a href="#authName"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>为当前context下的realm认证指定一个替代的名称。 如果没有指定,原realm名称将被使用。 认证名称将显示在浏览器登陆弹出窗口。</p> <h4>Syntax</h4><p>文本</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="required"><h3>Require(授权的用户/组)<span class="ls-permlink"><a href="#required"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定哪些用户/用户组可以访问此context。 这里允许你使用一个用户/组数据库(在 <span class="tagl"><a href="#realm">Realm</a></span>中指定)访问多个context, 但只允许该数据库下特定的用户/组访问这个context。</p> <h4>Syntax</h4><p>语法兼容Apache的Require指令。例如: <ul> <li><span class="val">user username [username ...]</span> <br/> 只有列出的用户可以访问这个context;</li> <li> <span class="val">group groupid [groupid ...]</span><br/> 用户必须属于列出的组才可以访问这个context。</li> </ul> 如果没有指定,所有有效的用户都可以访问这个资源。</p> </article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="accessAllowed"><h3>允许访问列表<span class="ls-permlink"><a href="#accessAllowed"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定允许访问这个context下资源的IP地址或子网。综合 <span class="tagl"><a href="#accessDenied">拒绝访问列表</a></span>项的配置以及服务器/虚拟主机级别访问控制, 可访问性将以客户端IP所符合的最小范围来确定。</p> <h4>Syntax</h4><p>逗号分隔的IP地址/子网列表。</p> <h4>Example</h4><div class="ls-example">子网络可以写成<span class="val">192.168.1.0/255.255.255.0</span>, <span class="val">192.168.1</span> 或<span class="val">192.168.1.*</span>。</div></article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="accessDenied"><h3>拒绝访问列表<span class="ls-permlink"><a href="#accessDenied"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定哪个IP地址或子网不被允许访问这个context下的资源。 综合<span class="tagl"><a href="#accessAllowed">允许访问列表</a></span>项的配置以及服务器/虚拟主机级别访问控制, 可访问性将以客户端IP所符合的最小范围来确定。</p> <h4>Syntax</h4><p>逗号分隔的IP地址/子网列表。</p> <h4>Example</h4><div class="ls-example">子网络可以写成<span class="val">192.168.1.0/255.255.255.0</span>, <span class="val">192.168.1</span> 或<span class="val">192.168.1.*</span>。</div></article> </div>
<div class="helpitem"><article class="ls-helpitem"><div><header id="extAuthorizer"><h3>Authorizer<span class="ls-permlink"><a href="#extAuthorizer"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>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 <a href="http://www.fastcgi.com" target="_blank" rel="noopener noreferrer">http://www.fastcgi.com</a>.</p> <h4>Syntax</h4><p>Select from drop down list</p> </article> </div>
</section>
</article><div class="ls-col-1-1"><footer class="copyright">Copyright © 2013-2018. <a href="https://www.litespeedtech.com">LiteSpeed Technologies Inc.</a> All rights reserved.</footer>
</div></div>
</body>
</html>