📄 rewriteguide.html.ko.euc-kr
字号:
立辟 肺弊 CGI 橇肺弊伐阑 角青且 荐 乐促.</p>
</dd>
</dl>
<h3>沥利俊辑 悼利栏肺</h3>
<dl>
<dt>惑炔汲疙:</dt>
<dd>
<p>绢痘霸 宏扼快历客 荤侩磊啊 葛福霸 磊楷胶反霸 沥利
其捞瘤 <code>foo.html</code>阑 悼利牢 <code>foo.cgi</code>肺
函版且 荐 乐唱.</p>
</dd>
<dt>秦搬氓:</dt>
<dd>
<p>URL阑 CGI 胶农赋飘肺 犁累己窍绊, MIME-type阑 荐沥窍咯
CGI 胶农赋飘肺 角青窍霸 茄促. 弊贰辑
<code>/~quux/foo.html</code>甫 夸没窍搁 郴何利栏肺
<code>/~quux/foo.cgi</code>甫 角青窍霸 等促.</p>
<div class="example"><pre>
RewriteEngine on
RewriteBase /~quux/
RewriteRule ^foo\.<strong>html</strong>$ foo.<strong>cgi</strong> [T=<strong>application/x-httpd-cgi</strong>]
</pre></div>
</dd>
</dl>
<h3>溜籍 牧刨明 犁积己</h3>
<dl>
<dt>惑炔汲疙:</dt>
<dd>
<p>捞 规过篮 角肺 厚扁捞促: 悼利栏肺 其捞瘤甫 积己窍瘤父,
沥利栏肺 其捞瘤甫 辑厚胶茄促. 溜, 其捞瘤绰 鉴荐窍霸
(颇老矫胶袍俊辑 佬篮 郴侩阑 弊措肺) 沥利 其捞瘤肺
傈崔登瘤父, 绝阑 版快 昆辑滚啊 悼利栏肺 积己茄促.
弊矾搁 穿啊 (趣篮 cron 累诀捞) 沥利 牧刨明甫 瘤快瘤臼绰
茄 CGI啊 积己茄 其捞瘤甫 沥利栏肺 辑厚胶茄促. 牧刨明甫
瘤快搁 郴侩阑 盎脚茄促.</p>
</dd>
<dt>秦搬氓:</dt>
<dd>
促澜 痹蘑阑 荤侩茄促:
<div class="example"><pre>
RewriteCond %{REQUEST_FILENAME} <strong>!-s</strong>
RewriteRule ^page\.<strong>html</strong>$ page.<strong>cgi</strong> [T=application/x-httpd-cgi,L]
</pre></div>
<p>咯扁辑 <code>page.html</code>甫 夸没且锭
<code>page.html</code>捞 绝芭唱 颇老农扁啊 0牢 版快
郴何利栏肺 <code>page.cgi</code>甫 角青茄促. 咯扁辑
厚搬篮 <code>page.cgi</code>啊 老馆利牢 CGI 胶农赋飘客
鞍捞 <code>STDOUT</code>俊 免仿窍绊, 眠啊肺 免仿阑
<code>page.html</code> 颇老俊 利绰促. 茄锅 角青茄饶
辑滚绰 <code>page.html</code>狼 沥焊甫 焊辰促. 昆包府磊啊
碍犁肺 郴侩阑 盎脚窍绊 酵促搁, (焊烹 cron 累诀捞)
<code>page.html</code>阑 瘤快扁父 窍搁 等促.</p>
</dd>
</dl>
<h3>磊悼栏肺 货肺 绊魔窍绰 巩辑</h3>
<dl>
<dt>惑炔汲疙:</dt>
<dd>
<p>汗棱茄 昆其捞瘤甫 父甸锭 祈笼磊啊 郴侩阑 荐沥且
锭付促 磊悼栏肺 其捞瘤甫 货肺 绊魔窍绰 昆宏扼快历啊
乐栏搁 倔付唱 亮阑鳖? 阂啊瓷茄啊?</p>
</dd>
<dt>秦搬氓:</dt>
<dd>
<p>啊瓷窍促! MIME multipart 扁瓷苞 昆辑滚 NPH 扁瓷,
<code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>狼 URL 炼累 瓷仿阑 搬钦窍搁
等促. 刚历, 货肺款 URL 扁瓷阑 父电促: URL俊
<code>:refresh</code>甫 眠啊窍扁父 窍搁 颇老矫胶袍俊辑
荐沥瞪 锭付促 货肺 绊魔茄促.</p>
<div class="example"><pre>
RewriteRule ^(/[uge]/[^/]+/?.*):refresh /internal/cgi/apache/nph-refresh?f=$1
</pre></div>
<p>捞力 促澜 URL俊 立辟窍搁</p>
<div class="example"><pre>
/u/foo/bar/page.html:refresh
</pre></div>
<p>促澜 URL阑 郴何利栏肺 何弗促</p>
<div class="example"><pre>
/internal/cgi/apache/nph-refresh?f=/u/foo/bar/page.html
</pre></div>
<p>捞力 NPH-CGI 胶农赋飘父 巢疽促. 焊烹 "刀磊俊霸
楷嚼栏肺 巢败狄"捞扼绊 富窍瘤父 ;-) 唱绰 捞巴档 力傍茄促.</p>
<div class="example"><pre>
#!/sw/bin/perl
##
## nph-refresh -- NPH/CGI script for auto refreshing pages
## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved.
##
$| = 1;
# split the QUERY_STRING variable
@pairs = split(/&/, $ENV{'QUERY_STRING'});
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/A-Z/a-z/;
$name = 'QS_' . $name;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
eval "\$$name = \"$value\"";
}
$QS_s = 1 if ($QS_s eq '');
$QS_n = 3600 if ($QS_n eq '');
if ($QS_f eq '') {
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
print "&lt;b&gt;ERROR&lt;/b&gt;: No file given\n";
exit(0);
}
if (! -f $QS_f) {
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
print "&lt;b&gt;ERROR&lt;/b&gt;: File $QS_f not found\n";
exit(0);
}
sub print_http_headers_multipart_begin {
print "HTTP/1.0 200 OK\n";
$bound = "ThisRandomString12345";
print "Content-type: multipart/x-mixed-replace;boundary=$bound\n";
&print_http_headers_multipart_next;
}
sub print_http_headers_multipart_next {
print "\n--$bound\n";
}
sub print_http_headers_multipart_end {
print "\n--$bound--\n";
}
sub displayhtml {
local($buffer) = @_;
$len = length($buffer);
print "Content-type: text/html\n";
print "Content-length: $len\n\n";
print $buffer;
}
sub readfile {
local($file) = @_;
local(*FP, $size, $buffer, $bytes);
($x, $x, $x, $x, $x, $x, $x, $size) = stat($file);
$size = sprintf("%d", $size);
open(FP, "&lt;$file");
$bytes = sysread(FP, $buffer, $size);
close(FP);
return $buffer;
}
$buffer = &readfile($QS_f);
&print_http_headers_multipart_begin;
&displayhtml($buffer);
sub mystat {
local($file) = $_[0];
local($time);
($x, $x, $x, $x, $x, $x, $x, $x, $x, $mtime) = stat($file);
return $mtime;
}
$mtimeL = &mystat($QS_f);
$mtime = $mtime;
for ($n = 0; $n &lt; $QS_n; $n++) {
while (1) {
$mtime = &mystat($QS_f);
if ($mtime ne $mtimeL) {
$mtimeL = $mtime;
sleep(2);
$buffer = &readfile($QS_f);
&print_http_headers_multipart_next;
&displayhtml($buffer);
sleep(5);
$mtimeL = &mystat($QS_f);
last;
}
sleep($QS_s);
}
}
&print_http_headers_multipart_end;
exit(0);
##EOF##
</pre></div>
</dd>
</dl>
<h3>措樊狼 啊惑龋胶飘</h3>
<dl>
<dt>惑炔汲疙:</dt>
<dd>
<p>啊惑龋胶飘啊 割俺父 乐促搁 酒颇摹狼 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>
扁瓷捞 肋 悼累茄促. 弊矾唱 啊惑龋胶飘啊 荐归俺 乐绰
ISP扼搁 捞 扁瓷捞 弥急篮 酒聪促.</p>
</dd>
<dt>秦搬氓:</dt>
<dd>
<p>捞 扁瓷阑 力傍窍妨搁 <dfn>Proxy Throughput</dfn>
扁瓷阑 (敲贰弊 <code>[P]</code>) 荤侩窍咯 寇何 昆其捞瘤
趣篮 傈眉 寇何 昆康开阑 快府狼 捞抚傍埃俊 措览茄促:</p>
<div class="example"><pre>
##
## vhost.map
##
www.vhost1.dom:80 /path/to/docroot/vhost1
www.vhost2.dom:80 /path/to/docroot/vhost2
:
www.vhostN.dom:80 /path/to/docroot/vhostN
</pre></div>
<div class="example"><pre>
##
## httpd.conf
##
:
# 府促捞泛飘且锭 沥痹 龋胶飘疙阑 荤侩茄促.
UseCanonicalName on
:
# 啊惑龋胶飘甫 CLF 屈侥 菊俊 眠啊茄促
CustomLog /path/to/access_log "%{VHOST}e %h %l %u %t \"%r\" %>s %b"
:
# 林辑滚俊辑 犁累己 浚柳阑 荤侩茄促
RewriteEngine on
# 滴 甘阑 沥狼茄促: 窍唱绰 URL阑 绊摹绊,
# 促弗 窍唱绰 啊惑龋胶飘喊 DocumentRoot甫
# 沥狼茄促.
RewriteMap lowercase int:tolower
RewriteMap vhost txt:/path/to/vhost.map
# 捞力 农绊 汗棱茄 痹蘑 茄俺甫 荤侩窍咯
# 啊惑龋胶飘肺 措览茄促.
#
# 1. 啊惑龋胶飘甸捞 鞍捞 荤侩窍绰 困摹绰 措览窍瘤 臼绰促
RewriteCond %{REQUEST_URI} !^/commonurl1/.*
RewriteCond %{REQUEST_URI} !^/commonurl2/.*
:
RewriteCond %{REQUEST_URI} !^/commonurlN/.*
#
# 2. 快府啊 泅犁 荤侩窍绰 规过捞 Host 庆歹甫
# 啊惑龋胶飘甫 瘤盔窍骨肺
# Host 庆歹啊 乐绰瘤 犬牢茄促
RewriteCond %{HTTP_HOST} !^$
#
# 3. 龋胶飘疙阑 家巩磊肺 父电促
RewriteCond ${lowercase:%{HTTP_HOST}|NONE} ^(.+)$
#
# 4. vhost.map俊辑 龋胶飘疙阑 茫绊
# 版肺老锭父 扁撅茄促
# (困俊辑 "NONE"篮 酒聪促)
RewriteCond ${vhost:%1} ^(/.*)$
#
# 5. 付瘤阜栏肺 URL阑 巩辑 困摹肺 措览窍绊
# 肺弊俊 巢扁扁困秦 啊惑龋胶飘甫 扁撅秦 敌促
RewriteRule ^/(.*)$ %1/$1 [E=VHOST:${lowercase:%{HTTP_HOST}}]
:
</pre></div>
</dd>
</dl>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="access" id="access">立辟 力茄</a></h2>
<h3>肺嚎 阜扁</h3>
<dl>
<dt>惑炔汲疙:</dt>
<dd>
<p>绢痘霸 窍搁 漂沥 昆傍埃狼 其捞瘤甫 避绢葛栏绰 蓖满篮
肺嚎阑 阜阑 荐 乐唱? "Robot Exclusion Protocol" 亲格阑
历厘茄 <code>/robots.txt</code> 颇老篮 焊烹 捞繁 肺嚎阑
阜绰单 面盒窍瘤 臼促.</p>
</dd>
<dt>秦搬氓:</dt>
<dd>
<p>(酒付档 叼泛配府啊 表绢辑 肺嚎捞 倒酒促聪搁 辑滚俊
何淬捞 奴 版快) 昆傍埃 <code>/~quux/foo/arc/</code>俊
乐绰 URL甸阑 芭何窍绰 痹蘑阑 荤侩茄促. 快府绰 漂沥
肺嚎狼 立辟阑 阜酒具 茄促. 溜, 肺嚎阑 角青窍绰 龋胶飘甫
阜绰 巴栏肺绰 阂面盒窍哥, 弊 龋胶飘狼 荤侩磊档 阜酒滚府霸
等促. User-Agent HTTP 庆歹 沥焊档 厚背茄促.</p>
<div class="example"><pre>
RewriteCond %{HTTP_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -