File manager - Edit - /usr/local/lswsbak/docs/zh-CN/Rewrite_Help.html
Back
<!DOCTYPE html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title>OpenLiteSpeed Users' Manual - 重写帮助</title> <meta name="description" content="OpenLiteSpeed Users' Manual - 重写帮助." /> <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> <h2 class="ls-text-thin"> OpenLiteSpeed Web Server <a href="index.html"> Users' Manual</a> </h2> <h3 class="ls-text-muted">Version 1.8 — Rev. 3</h3> <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> <li><a href="Real_Time_Stats_Help.html">Real-Time Stats</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><span class="current"><a href="Rewrite_Help.html">Rewrite</a></span></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><a href="Redirect_Context.html">Redirect Context</a></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="VHSSL_Help.html">虚拟主机SSL</a></div><div class="center"><a href="config.html">Configuration</a></div><div class="next"><a href="Context_Help.html">Context</a> »</div></div> <h1>重写帮助</h1><h2 id="top">Table of Contents</h2><section class="toc"><section class="toc-row"><header>重写控制</header><p> <a href="#enableRewrite">启用重写</a> | <a href="#autoLoadHtaccess">自动加载.htaccess</a> | <a href="#rewriteLogLevel">日志级别</a></p></section> <section class="toc-row"><header>Rewrite Map</header><p> <a href="#rewriteMapName">名称</a> | <a href="#rewriteMapLocation">Location</a></p></section> <section class="toc-row"><header>重写规则</header><p> <a href="#rewriteRules">重写规则</a></p></section> </section> <section><div class="helpitem"><article class="ls-helpitem"><div><header id="enableRewrite"><h3>启用重写<span class="ls-permlink"><a href="#enableRewrite"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定是否启用LiteSpeed的URL重写. 可以在虚拟主机或context级别上自定义此选项, 并且沿目录树继承该选项,直到被其他选项覆。</p> <h4>Syntax</h4><p>从单选框选择</p> </article> </div> <div class="helpitem"><article class="ls-helpitem"><div><header id="autoLoadHtaccess"><h3>自动加载.htaccess<span class="ls-permlink"><a href="#autoLoadHtaccess"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>如果使用<b>rewritefile</ b>指令的目录的HttpContext不存在,则在初次访问该目录时自动加载.htaccess文件中包含的重写规则。 最初加载后,必须执行正常重启才能使对该.htaccess文件的修改生效。<br/><br/> 虚拟主机级别设置将覆盖服务器级别设置。 默认值:<br/><br/> <b>Server-level:</b> No<br/><br/> <b>VH-Level:</b> Inherit Server-level setting</p> <h4>Syntax</h4><p>从单选框选择</p> </article> </div> <div class="helpitem"><article class="ls-helpitem"><div><header id="rewriteLogLevel"><h3>日志级别<span class="ls-permlink"><a href="#rewriteLogLevel"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定重写调试输出的详细程度。 此值的范围是<span class="val">0</span>-<span class="val">9</span>。 设置为<span class="val">0</span>将禁用日志记录。 设置为<span class="val">9</span>将产生 最详细的日志。 服务器和虚拟主机的错误日志<span class="tagl"><a href="ServGeneral_Help.html#log_logLevel">日志级别</a></span> 至少设置为<span class="val">INFO</span>才能使此选项生效。 这对测试重写规则很有帮助。</p> <h4>Syntax</h4><p>整数</p> <h4>See Also</h4><p class="ls-text-small">Server <span class="tagl"><a href="ServGeneral_Help.html#log_logLevel">日志级别</a></span>, Virtual Host <span class="tagl"><a href="VHGeneral_Help.html#vhlog_logLevel">日志级别</a></span></p> </article> </div> <div class="helpitem"><article class="ls-helpitem"><div><header id="rewriteMapName"><h3>名称<span class="ls-permlink"><a href="#rewriteMapName"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>Specifies a unique name for the rewrite map at the virtual host level. This name will be used by a mapping-reference in rewrite rules. When referencing this name, one of the following syntaxes should be used: <blockquote><code> $\{MapName:LookupKey\}<br/> $\{MapName:LookupKey|DefaultValue\} </code></blockquote><br/> The implementation of LiteSpeed's rewrite engine follows the specifications of Apache's rewrite engine. For more details about rewrite maps, please refer to <a href=" http://httpd.apache.org/docs/current/mod/mod_rewrite.html " target="_blank" rel="noopener noreferrer"> Apache's mod_rewrite document </a>.</p> <h4>Syntax</h4><p>string</p> </article> </div> <div class="helpitem"><article class="ls-helpitem"><div><header id="rewriteMapLocation"><h3>Location<span class="ls-permlink"><a href="#rewriteMapLocation"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>Specifies the location of the rewrite map using the syntax <span class="val">MapType:MapSource</span>.<br/> LiteSpeed's rewrite engine supports three types of rewrite maps: <ul> <li><b>Standard Plain Text</b> <blockquote> <b>MapType:</b> txt; <br/> <b>MapSource:</b> file path to a valid plain ASCII file. </blockquote> Each line of this file should contain two elements separated by blank spaces. The first element is the key and the second element is the value. Comments can be added with a leading "<span class="val">#</span>" sign. </li> <li><b>Randomized Plain Text</b> <blockquote> <b>MapType:</b> rnd;<br/> <b>MapSource:</b> file path of a valid plain ASCII file. </blockquote> File format is similar to the Standard Plain Text file, except that the second element can contain multiple choices separated by a "<span class="val">|</span>" sign and chosen randomly by the rewrite engine. </li> <li><b>Internal Function</b> <blockquote> <b>MapType:</b> int;<br/> <b>MapSource:</b> Internal string function </blockquote> 4 functions are available: <ul> <li><b>toupper:</b> converts lookup key to upper cases.</li> <li><b>tolower:</b> converts lookup key to lower cases.</li> <li><b>escape:</b> perform URL encoding on lookup key.</li> <li><b>unescape:</b> perform URL decoding on lookup key.</li> </ul> </li> The following map types available in Apache have not been implemented in LiteSpeed:<br/> Hash File and External Rewriting Program. </ul> The implementation of LiteSpeed's rewrite engine follows the specifications of Apache's rewrite engine. For more details about rewrite map, please refer to <a href=" http://httpd.apache.org/docs/current/mod/mod_rewrite.html " target="_blank" rel="noopener noreferrer"> Apache's mod_rewrite document </a>.</p> <h4>Syntax</h4><p>String</p> </article> </div> <div class="helpitem"><article class="ls-helpitem"><div><header id="rewriteRules"><h3>重写规则<span class="ls-permlink"><a href="#rewriteRules"></a></span><span class="top"><a href="#top">⇑</a></span></h3></header></div><h4>Description</h4><p>指定虚拟主机级别的重写规则。<br/><br/> 请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。 <br/><br/> 重写规则由一个<span class="val">RewriteRule</span>组成,并可可以在多个<span class="val">RewriteCond</span>之后。 <ul> <li>每行仅能有一条规则</li> <li> <span class="val">RewriteCond</span> 和 <span class="val">RewriteRule</span> 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。 </li> <li> LiteSpeed和Apache mod_rewrite之间有细微差别: <ul> <li> <span class="val">%\{LA-U:variable\}</span> and <span class="val">%\{LA-F:variable\}</span> 在Litespeed 重写中将被忽略 </li> <li> Litespeed中加入了两个新变量: <span class="val">%\{CURRENT_URI\}</span>表示正在处理的URL <span class="val">%\{SCRIPT_NAME\}</span>表示为相应的CGI环境变量。 </li> <li> Litespeed在遇到<span class="val">[L]</span>后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的<span class="val">[END]</span>标志。 </li> </ul> </li> </ul><br/> LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 <a href=" http://httpd.apache.org/docs/current/mod/mod_rewrite.html " target="_blank" rel="noopener noreferrer"> Apache's mod_rewrite document(英文文档) </a> 和 <a href=" http://httpd.apache.org/docs/current/rewrite/ " target="_blank" rel="noopener noreferrer"> Apache's URL rewriting guide(英文文档) </a>.</p> <h4>Syntax</h4><p>string</p> </article> </div> </section> </article><div class="ls-col-1-1"><footer class="copyright">Copyright © 2013-2020. <a href="https://www.litespeedtech.com">LiteSpeed Technologies Inc.</a> 版权所有.</footer> </div></div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings