📄 rewriteguide.xml.ko
字号:
[T=application/x-httpd-cgi,L]</pre></example> <p>弊矾搁 <code>xredirect:</code>肺 矫累窍绰 葛电 URL篮 <code>nph-xredirect.cgi</code> 橇肺弊伐阑 烹窍霸 等促. 橇肺弊伐篮 促澜苞 鞍促:</p><example><pre>#!/path/to/perl#### nph-xredirect.cgi -- NPH/CGI script for extended redirects## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved.##$| = 1;$url = $ENV{'PATH_INFO'};print "HTTP/1.0 302 Moved Temporarily\n";print "Server: $ENV{'SERVER_SOFTWARE'}\n";print "Location: $url\n";print "Content-type: text/html\n";print "\n";print "<html>\n";print "<head>\n";print "<title>302 Moved Temporarily (EXTENDED)</title>\n";print "</head>\n";print "<body>\n";print "<h1>Moved Temporarily (EXTENDED)</h1>\n";print "The document has moved <a HREF=\"$url\">here</a>.<p>\n";print "</body>\n";print "</html>\n";##EOF##</pre></example> <p>弊矾搁 <module>mod_rewrite</module>啊 流立 罐瘤给窍绰 葛电 URL scheme栏肺 府促捞泛记且 荐 乐促. 抗甫 甸绢, 促澜苞 鞍捞 <code>news:newsgroup</code>栏肺 府促捞泛记且 荐 乐促</p><example><pre>RewriteRule ^anyurl xredirect:news:newsgroup</pre></example> <note>林狼: 困狼 漂喊茄 "烹苞" 痹蘑阑 荤侩窍咯 <code>xredirect:</code>甫 付瘤阜俊 犬厘秦具 窍扁锭巩俊 痹蘑俊 <code>[R]</code>捞唱 <code>[R,L]</code>阑 荤侩窍搁 救等促.</note> </dd> </dl> </section> <section> <title>历厘家 立辟 吝拌(multiplexer)</title> <dl> <dt>惑炔汲疙:</dt> <dd> <p><a href="http://www.perl.com/CPAN">http://www.perl.com/CPAN</a>俊 乐绰 措窜茄 CPAN (Comprehensive Perl Archive Network)阑 酒绰啊? 捞 林家绰 技拌俊 瑞绢柳 咯矾 CPAN 固矾 FTP 辑滚吝 努扼捞攫飘俊 啊鳖捞 乐绰 辑滚肺 府促捞泛记茄促. 捞甫 FTP 立辟 吝拌 辑厚胶扼绊 茄促. CPAN篮 CGI 胶农赋飘甫 荤侩窍瘤父, <module>mod_rewrite</module>甫 荤侩窍咯 厚搅窍霸 父甸 荐 乐阑鳖?</p> </dd> <dt>秦搬氓:</dt> <dd> <p>刚历 <module>mod_rewrite</module> 3.0.0 滚傈何磐 府促捞泛记俊 "<code>ftp:</code>" scheme阑 荤侩且 荐 乐促. 促澜栏肺 努扼捞攫飘狼 弥惑困 档皋牢阑 <directive module="mod_rewrite">RewriteMap</directive>苞 鞍捞 荤侩窍咯 困摹甫 眠沥且 荐 乐促. 汗棱洒 揩牢 痹蘑俊辑 弥惑困 档皋牢阑 吝拌甘狼 虐肺 荤侩茄促.</p><example><pre>RewriteEngine onRewriteMap multiplex txt:/path/to/map.cxanRewriteRule ^/CxAN/(.*) %{REMOTE_HOST}::$1 [C]RewriteRule ^.+\.<strong>([a-zA-Z]+)</strong>::(.*)$ ${multiplex:<strong>$1</strong>|ftp.default.dom}$2 [R,L]</pre></example><example><pre>#### map.cxan -- Multiplexing Map for CxAN##de ftp://ftp.cxan.de/CxAN/uk ftp://ftp.cxan.uk/CxAN/com ftp://ftp.cxan.com/CxAN/ :##EOF##</pre></example> </dd> </dl> </section> <section> <title>矫埃俊 蝶弗 犁累己</title> <dl> <dt>惑炔汲疙:</dt> <dd> <p>矫埃俊 蝶扼 促弗 郴侩阑 辑厚胶窍绰 版快 腹篮 昆包府磊绰 泪矫 漂喊茄 其捞瘤肺 府促捞泛记窍扁困秦 CGI 胶农赋飘甫 荤侩茄促. <module>mod_rewrite</module>肺绰 绢痘霸 且 荐 乐绰啊?</p> </dd> <dt>秦搬氓:</dt> <dd> <p>犁累己 炼扒俊辑 荤侩且 荐 乐绰 咯矾 <code>TIME_xxx</code> 函荐啊 乐促. 函荐客 漂喊茄 荤傈鉴辑 厚背 <code><STRING</code>, <code>>STRING</code>, <code>=STRING</code>阑 荤侩窍咯 矫埃俊 蝶扼 府促捞泛记且 荐 乐促:</p><example><pre>RewriteEngine onRewriteCond %{TIME_HOUR}%{TIME_MIN} >0700RewriteCond %{TIME_HOUR}%{TIME_MIN} <1900RewriteRule ^foo\.html$ foo.day.htmlRewriteRule ^foo\.html$ foo.night.html</pre></example> <p>URL <code>foo.html</code>阑 夸没窍搁 <code>07:00-19:00</code> 悼救 <code>foo.day.html</code> 郴侩阑 辑厚胶窍绊, 唱赣瘤 矫埃 悼救 <code>foo.night.html</code> 郴侩阑 辑厚胶茄促. 权其捞瘤俊辑 荤侩窍扁 亮篮 扁瓷捞促...</p> </dd> </dl> </section> <section> <title>YYYY甫 XXXX肺 捞傈茄 版快 开龋券</title> <dl> <dt>惑炔汲疙:</dt> <dd> <p>咯矾 <code>.html</code> 颇老阑 <code>.phtml</code>肺 函券窍绰 殿 <code>document.YYYY</code>甫 <code>document.XXXX</code>肺 捞傈茄饶 开龋券(backward compatibility) URL阑 (啊惑利栏肺 粮犁窍霸) 父甸 荐 乐唱?</p> </dd> <dt>秦搬氓:</dt> <dd> <p>捞抚阑 扁夯捞抚栏肺 犁累己茄饶 货肺款 犬厘磊甫 啊柳 颇老捞 乐绰瘤 八荤茄促. 乐促搁 弊 颇老疙阑 荤侩窍绊, 绝栏搁 URL阑 盔贰 惑怕肺 犁累己茄促.</p><example><pre># 巩辑.html 捞 绝绊# 巩辑.phtml 父 乐绰 版快# 巩辑.html 阑 巩辑.phtml 肺# 犁累己窍绰 开龋券 痹蘑RewriteEngine onRewriteBase /~quux/# 扁夯捞抚阑 茫绊, 茫疽促绰 荤角阑 扁撅茄促RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]# 颇老捞 乐促搁 巩辑.phtml 肺 犁累己茄促RewriteCond %{REQUEST_FILENAME}.phtml -fRewriteRule ^(.*)$ $1.phtml [S=1]# 酒聪搁 菊俊辑 茫篮 扁夯捞抚阑 登倒赴促RewriteCond %{ENV:WasHTML} ^yes$RewriteRule ^(.*)$ $1.html</pre></example> </dd> </dl> </section> </section> <section id="content"> <title>牧刨明 促风扁</title> <section> <title>货肺 捞傈 (皑眠扁)</title> <dl> <dt>惑炔汲疙:</dt> <dd> <p>弥辟 <code>foo.html</code>阑 <code>bar.html</code>肺 函版窍绊 开龋券己阑 困秦 捞傈 URL阑 拌加 力傍窍绊 酵促绊 啊沥窍磊. 荤侩磊绰 捞傈 URL捞 函版登菌促绰 荤角阑 传摹盲瘤 给茄促.</p> </dd> <dt>秦搬氓:</dt> <dd> <p>促澜 痹蘑栏肺 捞傈 URL阑 郴何利栏肺 货肺款 URL肺 犁累己茄促:</p><example><pre>RewriteEngine onRewriteBase /~quux/RewriteRule ^<strong>foo</strong>\.html$ <strong>bar</strong>.html</pre></example> </dd> </dl> </section> <section> <title>货肺 捞傈 (舅府扁)</title> <dl> <dt>惑炔汲疙:</dt> <dd> <p>促矫 <code>foo.html</code>阑 <code>bar.html</code>肺 函版窍绊 开龋券己阑 困秦 捞傈 URL阑 拌加 力傍窍绊 酵促绊 啊沥窍磊. 弊矾唱 捞力绰 捞傈 URL阑 荤侩窍搁 荤侩磊俊霸 货肺款 URL阑 腮飘肺 舅妨霖促. 溜, 宏扼快历 林家芒捞 函茄促.</p> </dd> <dt>秦搬氓:</dt> <dd> <p>货肺款 URL肺 HTTP 府促捞泛记窍促. 弊矾搁 宏扼快历啊 货肺款 URL甫 焊捞绊 函版荤角阑 荤侩磊啊 舅霸等促:</p><example><pre>RewriteEngine onRewriteBase /~quux/RewriteRule ^<strong>foo</strong>\.html$ <strong>bar</strong>.html [<strong>R</strong>]</pre></example> </dd> </dl> </section> <section> <title>宏扼快历俊 蝶弗 郴侩</title> <dl> <dt>惑炔汲疙:</dt> <dd> <p>弥家茄 吝夸茄 弥惑困 其捞瘤绰 宏扼快历俊 弥利拳等 郴侩栏肺 辑厚胶秦具且 版快啊 乐促. 溜, 弥脚 Netscape 宏扼快历俊霸绰 弥惑狼 滚傈阑, Lynx 宏扼快历俊霸绰 弥历 滚傈阑, 唱赣瘤 宏扼快历俊绰 乞闭利牢 滚傈阑 力傍茄促.</p> </dd> <dt>秦搬氓:</dt> <dd> <p>宏扼快历啊 郴侩蛆惑阑 困秦 磊脚狼 辆幅俊 措茄 沥焊甫 力傍窍瘤 臼扁锭巩俊 郴侩蛆惑阑 荤侩且 荐 绝促. 措脚 HTTP "User-Agent" 庆歹甫 荤侩茄促. 促澜 痹蘑篮 HTTP "User-Agent" 庆歹啊 "Mozilla/3"栏肺 矫累窍搁 <code>foo.html</code> 其捞瘤甫 <code>foo.NS.html</code>肺 犁累己窍绊 犁累己阑 吝窜茄促. 宏扼快历啊 "Lynx"唱 "Mozilla" 滚傈 1 趣篮 2扼搁 URL篮 <code>foo.20.html</code>捞 等促. 唱赣瘤 宏扼快历绰 <code>foo.32.html</code> 其捞瘤甫 罐绰促. 酒贰 痹蘑捞 捞 累诀阑 茄促:</p><example><pre>RewriteCond %{HTTP_USER_AGENT} ^<strong>Mozilla/3</strong>.*RewriteRule ^foo\.html$ foo.<strong>NS</strong>.html [<strong>L</strong>]RewriteCond %{HTTP_USER_AGENT} ^<strong>Lynx/</strong>.* [OR]RewriteCond %{HTTP_USER_AGENT} ^<strong>Mozilla/[12]</strong>.*RewriteRule ^foo\.html$ foo.<strong>20</strong>.html [<strong>L</strong>]RewriteRule ^foo\.html$ foo.<strong>32</strong>.html [<strong>L</strong>]</pre></example> </dd> </dl> </section> <section> <title>悼利 固矾</title> <dl> <dt>惑炔汲疙:</dt> <dd> <p>寇何 龋胶飘俊 快府 荤捞飘肺 啊廉坷绊 酵篮 亮篮 昆其捞瘤啊 乐促绊 啊沥窍磊. FTP 辑滚狼 版快 流立 寇何 磊丰狼 弥脚汗荤夯阑 蜡瘤窍绰 <code>mirror</code> 橇肺弊伐阑 荤侩且 荐 乐绊, 昆辑滚扼搁 HTTP肺 厚搅茄 累诀阑 窍绰 <code>webcopy</code> 橇肺弊伐阑 荤侩且 荐 乐促. 弊矾唱 滴 规过 葛滴 窜痢捞 乐促: 汗荤夯篮 啊阐究 橇肺弊伐阑 角青秦临 锭父 弥脚魄栏肺 蜡瘤等促. 流立 备己秦具窍绰 沥利牢 固矾啊 酒聪扼搁 亮摆促. 措脚 (寇何 龋胶飘俊辑 磊丰啊 盎脚登搁) 鞘夸且锭 磊悼栏肺 磊丰甫 盎脚窍绰 悼利 固矾啊 鞘夸窍促.</p> </dd> <dt>秦搬氓:</dt> <dd> <p>捞甫 困秦 <dfn>Proxy Throughput</dfn> 扁瓷阑 (敲贰弊 <code>[P]</code>) 荤侩窍咯 寇何 昆其捞瘤 趣篮 寇何 昆傍埃 傈眉甫 快府 捞抚傍埃栏肺 措览茄促:</p><example><pre>RewriteEngine onRewriteBase /~quux/RewriteRule ^<strong>hotsheet/</strong>(.*)$ <strong>http://www.tstimpreso.com/hotsheet/</strong>$1 [<strong>P</strong>]</pre></example><example><pre>RewriteEngine onRewriteBase /~quux/RewriteRule ^<strong>usa-news\.html</strong>$ <strong>http://www.quux-corp.com/news/index.html</strong> [<strong>P</strong>]</pre></example> </dd> </dl> </section> <section> <title>悼利 开固矾</title> <dl> <dt>惑炔汲疙:</dt> <dd>...</dd> <dt>秦搬氓:</dt> <dd><example><pre>RewriteEngine onRewriteCond /mirror/of/remotesite/$1 -URewriteRule ^http://www\.remotesite\.com/(.*)$ /mirror/of/remotesite/$1</pre></example> </dd> </dl> </section> <section> <title>绝绰 磊丰甫 牢飘扼齿俊辑 啊廉坷扁</title> <dl> <dt>惑炔汲疙:</dt> <dd> <p>角力 磊丰甫 规拳寒捞 焊龋窍绰 (郴何) 牢飘扼齿 昆辑滚俊 (<code>www2.quux-corp.dom</code>) 历厘窍搁辑, 扁诀狼 (寇何) 牢磐齿 昆辑滚甫 (<code>www.quux-corp.dom</code>) 角青窍绰 巴贸烦 焊捞霸 茄促. 寇何 昆辑滚绰 夸没茄 磊丰甫 郴何 昆辑滚俊辑 啊廉柯促.</p> </dd> <dt>秦搬氓:</dt> <dd>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -