home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="EUC-KR"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko"><head><!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX This file is generated from xml source: DO NOT EDIT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --> <title>URL └τ└█╝║ ┴÷─º╝¡ - Apache HTTP Server</title> <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /> <link href="../images/favicon.ico" rel="shortcut icon" /></head> <body id="manual-page"><div id="page-header"> <p class="menu"><a href="../mod/">╕≡╡Γ</a> | <a href="../mod/directives.html">┴÷╜├╛ε╡Θ</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">┐δ╛ε</a> | <a href="../sitemap.html">╗τ└╠╞«╕╩</a></p> <p class="apache">Apache HTTP Server Version 2.0</p> <img alt="" src="../images/feather.gif" /></div> <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div> <div id="path"> <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Miscellaneous Documentation</a></div><div id="page-content"><div id="preamble"><h1>URL └τ└█╝║ ┴÷─º╝¡</h1> <div class="toplang"> <p><span>░í┤╔╟╤ ╛≡╛ε: </span><a href="../en/misc/rewriteguide.html" hreflang="en" rel="alternate" title="English"> en </a> | <a href="../ko/misc/rewriteguide.html" title="Korean"> ko </a></p> </div> <div class="note"> <p>┐°└·└┌<br /> <cite>Ralf S. Engelschall <rse@apache.org></cite><br /> 1997│Γ 12┐∙</p> </div> <p>└╠ ╣«╝¡┤┬ <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> <a href="../mod/mod_rewrite.html">┬ⁿ┴╢ ╣«╝¡</a>╕ª ║╕├µ╟╤┤┘. └╠ ╣«╝¡┤┬ └Ñ░ⁿ╕«└┌░í ╜╟┴ª └█╛≈┐í╝¡ ║╬╡·─í░╘╡╟┤┬ └ⁿ╟ⁿ└√└╬ URL░ⁿ╖├ ╣«┴ª╕ª ╟╪░ß╟╧▒Γ└º╟╪╝¡ ╛ε╢╗░╘ ╛╞╞──í <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>╕ª ╗τ┐δ╟╧┤┬┴÷ ╝│╕φ╟╤┤┘. URL └τ└█╝║ ▒╘─ó└╗ ╝│┴ñ╟╧┐⌐ ╣«┴ª╕ª ╟╪░ß╟╧┤┬ ╣µ╣²└╗ └┌╝╝╚≈ ╝│╕φ╟╤┤┘.</p> </div> <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#ToC1"><code>mod_rewrite</code> ╝╥░│</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#ToC2">╜╟┐δ└√└╬ ╟╪░ß├Ñ</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#url">URL ▒╕┴╢</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#content">─┴┼┘├≈ ┤┘╖τ▒Γ</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#access">┴ó▒┘ ┴ª╟╤</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#other">▒Γ┼╕</a></li> </ul></div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> <h2><a name="ToC1" id="ToC1"><code>mod_rewrite</code> ╝╥░│</a></h2> <p>╛╞╞──í <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> ╕≡╡Γ└║ ▒▓└σ╟╧┤┘. ┴∩, URL└╗ ┴╢└█╟╥ ╝÷ └╓┤┬ ░¡╖┬╟╧░φ ╜╟╖╬ ┴ñ▒│╟╤ ╕≡╡Γ└╠┤┘. ╗≤╗≤╟╪┐╘┤° ░┼└╟ ╕≡╡τ ┴╛╖∙└╟ URL ┴╢└█└╠ ░í┤╔╟╧┤┘. ▒╫╖»│¬ ▒╫ ┤δ░í╖╬ ╗τ┐δ╟╧▒Γ ║╣└Γ╟╧┤┘. <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>└╟ ├╓┤δ ┤▄┴í└║ ├╩║╕└┌░í └╠╟╪╟╧░φ ╗τ┐δ╟╧▒Γ ╜▒┴÷ ╛╩┤┘┤┬ ┴í└╠┤┘. ╜╔┴÷╛ε ╛╞╞──í └ⁿ╣«░í╡╡ ┴╛┴╛ <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>└╟ ╗⌡╖╬┐ε ┐δ╡╡╕ª ╣▀░▀╟╤┤┘.</p> <p>┤┘╕Ñ ╕╗╖╬: <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>┐í ┤δ╟╪ ┤τ╜┼└║ ├│└╜┐í ░╠└╗ ╕╘░φ └²┤δ╖╬ ┤┘╜├ ╗τ┐δ╟╧┴÷ ╛╩░┼│¬, ░¡╖┬╟╘┐í ╕┼╖ß╡╟╛ε ╛╒└╕╖╬ ╗ε ╡┐╛╚ ╗τ╢√┐í ║ⁿ┴· ░═└╠┤┘. └╠ ▒█└║ ├╣╣°┬░ ░µ┐∞╕ª ╕╖▒Γ└º╟╪ └╠╣╠ ╛╦╖┴┴° ╕ε░í┴÷ ╝║░°╗τ╖╩╕ª ╝╥░│╟╧╖┴░φ ╟╤┤┘.</p> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> <h2><a name="ToC2" id="ToC2">╜╟┐δ└√└╬ ╟╪░ß├Ñ</a></h2> <p>└╠┴ª │╗░í ┴≈┴ó ╕╕╡Θ╛·░┼│¬ ┤┘╕Ñ ╗τ╢≈╡Θ└╠ ╕╕╡τ ╕╣└║ ╜╟┐δ└√└╬ ╟╪░ß├Ñ└╠ │¬┐┬┤┘. ┐╣┴ª┐í╝¡ URL └τ└█╝║└╟ ╚µ╕╢╝·└╗ ╕╢└╜▓» ╣Φ┐∞▒µ ╣┘╢⌡┤┘.</p> <div class="warning">┴╓└╟: ╝¡╣÷ ╝│┴ñ┐í ╡√╢≤ ╗≤╚▓┐í ╕┬░╘ ┐╣┴ª╕ª ┴╢▒▌ ╝÷┴ñ╟╪╛▀ ╟╥ ░µ┐∞░í └╓┤┘. ┐╣╕ª ╡Θ╛ε, ├▀░í╖╬ <code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code>, <code class="module"><a href="../mod/mod_userdir.html">mod_userdir</a></code> ╡ε└╗ ╗τ┐δ╟╤┤┘╕Θ <code>[PT]</code> ╟├╖í▒╫╕ª ├▀░í╟╤┤┘. ╚ñ└║ ┴╓╝¡╣÷╝│┴ñ/░í╗≤╚ú╜║╞« ╗τ┐δ└σ╝╥░í ╛╞┤╤ <code>.htaccess</code> ╗τ┐δ└σ╝╥┐í ╛╦╕┬░╘ ▒╘─ó└╗ ╝÷┴ñ╟╥ ╝÷╡╡ └╓┤┘. ╗τ┐δ╟╧▒Γ └ⁿ┐í ╟╫╗≤ ▒╘─ó└╠ ╛ε╢▓ ▒Γ┤╔└╗ ╟╧┤┬┴÷ └╠╟╪╟╧╡╡╖╧ ╟╪╢≤. ▒╫╖»╕Θ ╣«┴ª╕ª ╟╟╟╥ ╝÷ └╓┤┘.</div> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> <h2><a name="url" id="url">URL ▒╕┴╢</a></h2> <h3>▒Γ┴╪└╠ ╡╟┤┬ URL</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>╟╤ ╕«╝╥╜║┐í ┤δ╟╪ ┐⌐╖» URL└╗ ░í┴÷┤┬ └Ñ╝¡╣÷░í └╓┤┘. ║╕┼δ (╜╟┴ª ╗τ┐δ╟╧░φ ╛╦╖┴┴«╛▀ ╟╥) ▒Γ┴╪└╠ ╡╟┤┬ URL░·, ┤▄├α ╚ñ└║ │╗║╬ ┐δ╡╡└╟ URL└╠ └╓┤┘. ╗τ┐δ└┌░í ┐Σ├╗┐í ╛ε╢▓ URL└╗ ╗τ┐δ╟╧┤°┴÷ ▒Γ┴╪└╠ ╡╟┤┬ URL╕╕└╗ ║╕┐⌐┴α╛▀ ╟╤┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>▒Γ┴╪└╠ ╡╟┴÷╛╩┤┬ ╕≡╡τ URL└╗ ║Ω╢≤┐∞└·░í ╛╦╡╡╖╧ ░φ─í▒Γ└º╟╪ ┐▄║╬ HTTP ╕«┤┘└╠╖║╝╟╟╤┤┘. ┐╣╕ª ╡Θ╛ε ╛╞╖í ▒╘─ó└║ <code>/~user</code>╕ª ▒Γ┴╪└╠ ╡╟┤┬ <code>/u/user</code>╖╬ ┤δ├╝╟╧░φ, <code>/u/user</code> ╕╢┴÷╕╖┐í ╜╜╖í╜¼░í ╛°┤┘╕Θ ├▀░í╟╤┤┘.</p> <div class="example"><pre> RewriteRule ^/<strong>~</strong>([^/]+)/?(.*) /<strong>u</strong>/$1/$2 [<strong>R</strong>] RewriteRule ^/([uge])/(<strong>[^/]+</strong>)$ /$1/$2<strong>/</strong> [<strong>R</strong>] </pre></div> </dd> </dl> <h3>▒Γ┴╪└╠ ╡╟┤┬ ╚ú╜║╞«╕φ</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd>└╠ ▒╘─ó└║ ╡┐└╧╟╤ ╗τ└╠╞«┐í ╡╡┤▐╟╥ ╝÷ └╓┤┬ ┤┘╕Ñ ╚ú╜║╞«╕φ ┤δ╜┼ ╞»┴ñ ╚ú╜║╞«╕φ└╗ ╗τ┐δ╟╧╡╡╖╧ ░¡┴ª╟╤┤┘. ┐╣╕ª ╡Θ╛ε, <strong>example.com</strong> ┤δ╜┼ <strong>www.example.com</strong>└╗ ╗τ┐δ╟╧╡╡╖╧ ░¡┴ª╟╧░φ ╜═┤┘╕Θ ┤┘└╜░· ░░└║ ▒╘─ó└╗ ╗τ┐δ╟╥ ╝÷ └╓┤┘.</dd> <dt>╟╪░ß├Ñ:</dt> <dd> <div class="example"><pre> # 80╣°└╠ ╛╞┤╤ ╞≈╞«┐í╝¡ ╜╟╟α╟╧┤┬ ╗τ└╠╞«┐δ RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} !^80$ RewriteRule ^/(.*) http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R] # ▒╫╕«░φ, 80╣° ╞≈╞«┐í╝¡ ╜╟╟α╟╧┤┬ ╗τ└╠╞«┐δ RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://fully.qualified.domain.name/$1 [L,R] </pre></div> </dd> </dl> <h3><code>DocumentRoot</code>╕ª ┐┼▒Σ ░µ┐∞</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>└Ñ╝¡╣÷└╟ <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>┤┬ ║╕┼δ URL "<code>/</code>"░· ┴≈┴ó ░ⁿ╖├└╓┤┘. ▒╫╖»│¬ └╠░≈┐í ╕≡╡τ └┌╖ß░í └╓┴÷ ╛╩░φ, └┌╖ß░í ┤┘╕Ñ ┐⌐╖» ░≈┐í ╚≡╛ε┴«└╓┤┬ ░µ┐∞░í └╓┤┘. ┐╣╕ª ╡Θ╛ε └╬╞«╢≤│▌ ╗τ└╠╞«┐í (┐▄║╬╕ª └º╟╤ ╚¿╞Σ└╠┴÷) <code>/e/www/</code>┐═ (└╬╞«╢≤│▌└╗ └º╟╤ ╚¿╞Σ└╠┴÷) <code>/e/sww/</code>░í └╓┤┘░φ ╟╧└┌. └╠┴ª <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>░í <code>/e/www/</code>└╠▒Γ╢º╣«┐í, ┐Σ├╗┐í╝¡ ╞Σ└╠┴÷┐í ╞≈╟╘╡╚ ▒╫╕▓ ╡ε└╗ └╠░≈┐í╝¡ ░í┴«┐═╛▀ ╟╤┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>┐∞╕«┤┬ URL <code>/</code>╕ª <code>/e/www/</code>╖╬ ╕«┤┘└╠╖║╝╟╕╕ ╟╧╕Θ ╡╚┤┘. ╗τ╝╥╟╪ ║╕└╠┴÷╕╕ ╜╟┴ª╖╬ <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>╕ª ╗τ┐δ╟╪╝¡╕╕ ░í┤╔╟╧┤┘. (<code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code> ╡ε└╠ ┴ª░°╟╧┤┬) URL <em>Alias</em> ░░└║ └ⁿ╟ⁿ└√└╬ ╣µ╣²└║ <em>╛╒║╬║╨</em>╕╕ ├ú┤┬┤┘. <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>░í ╕≡╡τ URL└╟ ╛╒║╬║╨└╠▒Γ╢º╣«┐í └╠ ╣µ╣²└╗ ╗τ┐δ╟╧┐⌐ ╕«┤┘└╠╖║╝╟└╗ ╟╥ ╝÷ ╛°┤┘. <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>╕ª ╗τ┐δ╟╧╕Θ ┴°┬Ñ ░ú┤▄╟╧┤┘:</p> <div class="example"><pre> RewriteEngine on RewriteRule <strong>^/$</strong> /e/www/ [<strong>R</strong>] </pre></div> </dd> </dl> <h3>╕╢┴÷╕╖ ╜╜╖í╜¼ ╣«┴ª</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>╡≡╖║┼Σ╕«╕ª ┴÷─¬╟╧┤┬ URL└╟ ╕╢┴÷╕╖ ╜╜╖í╜¼ ╣«┴ª░í ╛°┤┘╕Θ ╕≡╡τ └Ñ░ⁿ╕«└┌┤┬ ╚»╚ú╟╥ ░═└╠┤┘. ╜╜╖í╜¼░í ╛°┤┘╕Θ, ┴∩ <code>/~quux/foo/</code> ┤δ╜┼ <code>/~quux/foo</code>╕ª ╗τ┐δ╟╧╕Θ ╝¡╣÷░í <code>foo</code>╢≤┤┬ <em>╞─└╧</em>└╗ ├ú▒Γ╢º╣«┐í ┐└╖∙░í ╣▀╗²╟╤┤┘. ╞─└╧└╠ ╡≡╖║┼Σ╕«└╠▒Γ╢º╣«┐í ╣▐╛╞╡Θ└╠┴÷ ╛╩┤┬┤┘. ┤δ║╬║╨└╟ ░µ┐∞ ║╕┼δ ╝¡╣÷░í └┌╡┐└╕╖╬ URL└╗ ░φ─í┴÷╕╕, ░í▓√ ┴≈┴ó ╟╪┴α╛▀ ╟╥ ░µ┐∞░í └╓┤┘. ┐╣╕ª ╡Θ╛ε, CGI ╜║┼⌐╕│╞« ╡ε└╕╖╬ ║╣└Γ╟╤ URL └τ└█╝║└╗ ╟╤ ╚─┐í ▒╫╖»╟╧┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>└╠ ╣╠╣ª╟╤ ╣«┴ª└╟ ╟╪░ß╣µ╣²└║ ╝¡╣÷░í └┌╡┐└╕╖╬ ╕╢┴÷╕╖ ╜╜╖í╜¼╕ª ├▀░í╟╧┤┬ ░═└╠┤┘. ║Ω╢≤┐∞└·░í │¬╕╙┴÷ ▒╫╕▓ ╡ε└╗ ┐├╣┘╖╬ ┐Σ├╗╟╥ ╝÷ └╓╡╡╖╧, ┐▄║╬ ╕«┤┘└╠╖║╝╟└╗ ╟╪╛▀ ╟╤┤┘. │╗║╬ ╕«┤┘└╠╖║╝╟└╗ ╟╤┤┘╕Θ ╡≡╖║┼Σ╕« ╞Σ└╠┴÷┐í╕╕ ╡┐└█╟╧┐⌐ └╠ ╞Σ└╠┴÷░í ╗≤┤δ URL╖╬ ╞≈╟╘╟╧┤┬ ▒╫╕▓└╗ ║Ω╢≤┐∞└·░í ┐Σ├╗╟╥╢º ├ú└╗ ╝÷ ╛°┤┘. ┐╣╕ª ╡Θ╛ε, ┐▄║╬ ╕«┤┘└╠╖║╝╟└╗ ╗τ┐δ╟╧┴÷ ╛╩└╗╢º <code>/~quux/foo/index.html</code>┐í╝¡ <code>image.gif</code>╕ª ┐Σ├╗╟╧╕Θ <code>/~quux/image.gif</code>╕ª ┐Σ├╗╟╧░╘ ╡╚┤┘!</p> <p>▒╫╖í╝¡ └╠╕ª ╟╪░ß╟╧▒Γ└º╟╪ ┤┘└╜░· ░░└╠ ╝│┴ñ╟╤┤┘:</p> <div class="example"><pre> RewriteEngine on RewriteBase /~quux/ RewriteRule ^foo<strong>$</strong> foo<strong>/</strong> [<strong>R</strong>] </pre></div> <p>╚¿╡≡╖║┼Σ╕«└╟ ├╓╗≤└º <code>.htaccess</code> ╞─└╧┐í ┤┘└╜░· ░░└╠ ╝│┴ñ╟╥ ╝÷╡╡ └╓┤┘. ▒╫╖»│¬ ├│╕«╟╧┤┬╡Ñ ║╬┤π└╠ ╡╚┤┘.</p> <div class="example"><pre> RewriteEngine on RewriteBase /~quux/ RewriteCond %{REQUEST_FILENAME} <strong>-d</strong> RewriteRule ^(.+<strong>[^/]</strong>)$ $1<strong>/</strong> [R] </pre></div> </dd> </dl> <h3>└╧░ⁿ╡╚ URL ▒╕┴╢╖╬ ╕╕╡τ └Ñ┼¼╖»╜║┼═</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>└╬╞«╢≤│▌ └Ñ╝¡╣÷▒║└╟ ╕≡╡τ └Ñ╝¡╣÷┐í ╡┐└╧╟╧░φ └╧░ⁿ╡╚ URL ▒╕┴╢╕ª ╕╕╡Θ░φ ╜═┤┘. ┴∩, ╕≡╡τ (┴ñ└╟╗≤ ╝¡╣÷┐í ╝╙╟╧┐⌐ ╝¡╣÷┐í └╟┴╕└√└╬!) URL└╗ ╝¡╣÷ <em>╡╢╕│└√└╕╖╬</em> ╕╕╡τ┤┘! └Ñ └╠╕º░°░ú┐í ╝¡╣÷╡╢╕│└√└╬ ╡┐└╧╟╤ ▒╕┴╢╕ª ║╬┐⌐╟╪╛▀ ╟╤┤┘: URL└║ ╜╟┴ª ╝¡╣÷╕ª ┴÷─¬╟╧╕Θ ╛╚╡╚┤┘. ╝¡╣÷▒║└╠ └┌╡┐└╕╖╬ ╜╟┴ª ╝¡╣÷╖╬ └»╡╡╟╤┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╕╒└· ╗τ┐δ└┌, ▒╫╖∞, ╡╢╕│├╝└╟ └º─í ┴ñ║╕╕ª └·└σ╟╤ (║╨╗Ω╡╚) ┐▄║╬╕╩┐í ╜╟┴ª ╝¡╣÷ ┴ñ║╕╕ª ╛≥╛ε┐┬┤┘. ┐▄║╬╕╩└║ ┤┘└╜░· ░░└║ ╟ⁿ╜─└╠┤┘</p> <div class="example"><pre> user1 server_of_user1 user2 server_of_user2 : : </pre></div> <p>┐∞╕«┤┬ └╠ ┴ñ║╕╕ª ░ó░ó <code>map.xxx-to-host</code> ╞─└╧┐í └·└σ╟▀┤┘. ┤┘└╜└╕╖╬ ╕≡╡τ ╝¡╣÷┐í╝¡ URL└╠ ╝¡╣÷┐í ╛°┤┘╕Θ ┤┘└╜░· ░░└║ URL└╗,</p> <div class="example"><pre> /u/user/anypath /g/group/anypath /e/entity/anypath </pre></div> <p>┤┘└╜░· ░░└╠ ╕«┤┘└╠╖║╝╟╟╤┤┘</p> <div class="example"><pre> http://physical-host/u/user/anypath http://physical-host/g/group/anypath http://physical-host/e/entity/anypath </pre></div> <p>╛╞╖í ▒╘─ó└║ ╕╩╞─└╧└╗ ╗τ┐δ╟╧┐⌐ └╠ └█╛≈└╗ ╟╤┤┘ (server0└║ ╕╩┐í ╟╫╕±└╠ ╛°┤┬ ░µ┐∞ ╗τ┐δ╟╥ ▒Γ║╗╝¡╣÷╢≤░φ ░í┴ñ╟╤┤┘):</p> <div class="example"><pre> RewriteEngine on RewriteMap user-to-host txt:/path/to/map.user-to-host RewriteMap group-to-host txt:/path/to/map.group-to-host RewriteMap entity-to-host txt:/path/to/map.entity-to-host RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${user-to-host:$1|server0}</strong>/u/$1/$2 RewriteRule ^/g/<strong>([^/]+)</strong>/?(.*) http://<strong>${group-to-host:$1|server0}</strong>/g/$1/$2 RewriteRule ^/e/<strong>([^/]+)</strong>/?(.*) http://<strong>${entity-to-host:$1|server0}</strong>/e/$1/$2 RewriteRule ^/([uge])/([^/]+)/?$ /$1/$2/.www/ RewriteRule ^/([uge])/([^/]+)/([^.]+.+) /$1/$2/.www/$3\ </pre></div> </dd> </dl> <h3>╚¿╡≡╖║┼Σ╕«╕ª ┤┘╕Ñ └Ñ╝¡╣÷╖╬ └╠└ⁿ</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>╕╣└║ └Ñ░ⁿ╕«└┌┤┬ └Ñ╝¡╣÷└╟ ╕≡╡τ ╚¿╡≡╖║┼Σ╕«╕ª ┤┘╕Ñ └Ñ╝¡╣÷╖╬ └╠└ⁿ╟╤ ░µ┐∞ ╟╪░ß├Ñ└╗ ╣░╛ε║╗┤┘. └╠ ╣µ╣²└║ └╠└ⁿ ╝¡╣÷╕ª ┤δ├╝╟╥ ╗⌡╖╬┐ε ╝¡╣÷╕ª ▒╕╝║╟╧┤┬╡Ñ ╜├░ú└╠ ░╔╕«┤┬ ░µ┐∞┐í ╟╩┐Σ╟╧┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>╕ª ╗τ┐δ╟╧╕Θ ░ú┤▄╟╧┤┘. └╠└ⁿ └Ñ╝¡╣÷┤┬ ╕≡╡τ <code>/~user/anypath</code> URL└╗ <code>http://newserver/~user/anypath</code>╖╬ ╕«┤┘└╠╖║╝╟╟╧╕Θ ╡╚┤┘.</p> <div class="example"><pre> RewriteEngine on RewriteRule ^/~(.+) http://<strong>newserver</strong>/~$1 [R,L] </pre></div> </dd> </dl> <h3>╚¿╡≡╖║┼Σ╕« ▒╕┴╢ ╕╕╡Θ▒Γ</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>╗τ┐δ└┌░í ╝÷├╡╕φ└╬ ╗τ└╠╞«┤┬ ║╕┼δ ╚¿╡≡╖║┼Σ╕« ▒╕┴╢╕ª ╕╕╡τ┤┘. ┴∩, ┐╣╕ª ╡Θ╛ε └╠╕º└╠ ╗τ┐δ└┌╕φ└╟ ├╣╣°┬░ ╣«└┌└╬ ╟╧└º╡≡╖║┼Σ╕«┐í ╚¿╡≡╖║┼Σ╕«╕ª ╡╨┤┘. ▒╫╖í╝¡, <code>/~foo/anypath</code>┤┬ <code>/home/<strong>f</strong>/foo/.www/anypath</code>└╠░φ, <code>/~bar/anypath</code>┤┬ <code>/home/<strong>b</strong>/bar/.www/anypath</code>└╠┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╣░░ß╟Ñ╜├░í └╓┤┬ URL└╗ └º┐═ ░░└║ ▒╕┴╢╖╬ ║»╚»╟╧▒Γ└º╟╪ ┤┘└╜ ▒╘─ó└╗ ╗τ┐δ╟╤┤┘.</p> <div class="example"><pre> RewriteEngine on RewriteRule ^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*) /home/<strong>$2</strong>/$1/.www$3 </pre></div> </dd> </dl> <h3>╞─└╧╜├╜║┼█ └τ▒╕╝║</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>└╠ ┐╣┤┬ ╜╟╖╬ ╟╧╡σ─┌╛ε└√└╠┤┘: ╡≡╖║┼Σ╕«║░ <code>RewriteRules</code>╕ª ╕┼┐∞ ╕╣└╠ ╗τ┐δ╟╧┐⌐ └┌╖ß └┌├╝┤┬ ▒╫┤δ╖╬ ╡╨├╝╖╬ └Ñ┐í └┌╖ß╕ª └┌┐¼╜║╖┤░╘ ║Ω╢≤┐∞┬í╟╧╡╡╖╧ ╟╤┤┘. ╣Φ░µ: │¬┤┬ 1992│Γ ║╬┼═ └┌└»╖╙░╘ ╗τ┐δ╟╥ ╝÷ └╓┤┬ └»┤╨╜║ ╝╥╟┴╞«┐■╛ε╡Θ└╗ <strong><em>net.sw</em></strong>┐í ╕≡╛╞╡╬░φ └╓╛·┤┘. └╠┤┬ │╗░í ──╟╗┼═░·╟╨└╗ ░°║╬╟╧╕Θ╝¡ ┐⌐╖»╟╪╡┐╛╚ ┐⌐░í╜├░ú┐í ╜├╜║┼█ ░ⁿ╕«└┌┐═ │╫╞«┐≈ ░ⁿ╕«└┌╕ª ╟╪┐╘▒Γ╢º╣«┐í │╗ ├δ╣╠└╠└┌ └╧└╠┤┘. ╕┼┴╓╕╢┤┘ ╗⌡╖╬ ╝╥╟┴╞«┐■╛ε░í ├▀░í╡╔ ╢º╕╢┤┘ ╡≡╖║┼Σ╕«╕ª ▒φ░╘ ╕╕╡Θ╛ε┐╘┤┘:</p> <div class="example"><pre> drwxrwxr-x 2 netsw users 512 Aug 3 18:39 Audio/ drwxrwxr-x 2 netsw users 512 Jul 9 14:37 Benchmark/ drwxrwxr-x 12 netsw users 512 Jul 9 00:34 Crypto/ drwxrwxr-x 5 netsw users 512 Jul 9 00:41 Database/ drwxrwxr-x 4 netsw users 512 Jul 30 19:25 Dicts/ drwxrwxr-x 10 netsw users 512 Jul 9 01:54 Graphic/ drwxrwxr-x 5 netsw users 512 Jul 9 01:58 Hackers/ drwxrwxr-x 8 netsw users 512 Jul 9 03:19 InfoSys/ drwxrwxr-x 3 netsw users 512 Jul 9 03:21 Math/ drwxrwxr-x 3 netsw users 512 Jul 9 03:24 Misc/ drwxrwxr-x 9 netsw users 512 Aug 1 16:33 Network/ drwxrwxr-x 2 netsw users 512 Jul 9 05:53 Office/ drwxrwxr-x 7 netsw users 512 Jul 9 09:24 SoftEng/ drwxrwxr-x 7 netsw users 512 Jul 9 12:17 System/ drwxrwxr-x 12 netsw users 512 Aug 3 20:15 Typesetting/ drwxrwxr-x 10 netsw users 512 Jul 9 14:08 X11/ </pre></div> <p>1996│Γ 7┐∙ └╠ └·└σ╝╥╕ª ╕┌└╓┤┬ └Ñ └╬┼═╞Σ└╠╜║╕ª ┼δ╟╪ ╝╝╗≤┐í ░°░│╟╧▒Γ╖╬ ░ß┴ñ╟▐┤┘. "╕┌└╓┤┘"┤┬ ╕╗└║, ├╓╗≤└º ╡≡╖║┼Σ╕«┐í CGI ╜║┼⌐╕│╞«╕ª ╡╬┴÷ ╛╩░φ╡╡, └·└σ╝╥ ░Φ├■▒╕┴╢╕ª ┴≈┴ó ║Ω╢≤┐∞┴·╟╧▒µ ╣┘╢⌡┤┘┤┬ ╢µ└╠┤┘. ┐╓? └·└σ╝╥╕ª │¬┴▀┐í FTP╖╬╡╡ ┴ó▒┘╟╥ ╝÷ └╓╡╡╖╧ ╕╕╡Θ ┐╣┴ñ└╠┐┤▒Γ╢º╣«┐í └Ñ└╠│¬ CGI┐═ ░ⁿ╖├╡╚ │╗┐δ└╗ ░░└╠ ╡╬▒Γ ╜╚╛·┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╟╪░ß├Ñ└║ ╡╬ ║╬║╨└╕╖╬ │¬┤╢┤┘: ╕╒└· ╡≡╖║┼Σ╕« ╝÷┴╪┐í╝¡ ╟╩┐Σ╟╤ ╕≡╡τ ╞Σ└╠┴÷╕ª ╡┐└√└╕╖╬ ╕╕╡σ┤┬ CGI ╜║┼⌐╕│╞«░í ╟╩┐Σ╟╧┤┘. │¬┤┬ └╠ ╜║┼⌐╕│╞«╡Θ└╗ ┤┘└╜░· ░░└╠ <code>/e/netsw/.www/</code>┐í ╡╬╛·┤┘:</p> <div class="example"><pre> -rw-r--r-- 1 netsw users 1318 Aug 1 18:10 .wwwacl drwxr-xr-x 18 netsw users 512 Aug 5 15:51 DATA/ -rw-rw-rw- 1 netsw users 372982 Aug 5 16:35 LOGFILE -rw-r--r-- 1 netsw users 659 Aug 4 09:27 TODO -rw-r--r-- 1 netsw users 5697 Aug 1 18:01 netsw-about.html -rwxr-xr-x 1 netsw users 579 Aug 2 10:33 netsw-access.pl -rwxr-xr-x 1 netsw users 1532 Aug 1 17:35 netsw-changes.cgi -rwxr-xr-x 1 netsw users 2866 Aug 5 14:49 netsw-home.cgi drwxr-xr-x 2 netsw users 512 Jul 8 23:47 netsw-img/ -rwxr-xr-x 1 netsw users 24050 Aug 5 15:49 netsw-lsdir.cgi -rwxr-xr-x 1 netsw users 1589 Aug 3 18:43 netsw-search.cgi -rwxr-xr-x 1 netsw users 1885 Aug 1 17:41 netsw-tree.cgi -rw-r--r-- 1 netsw users 234 Jul 30 16:35 netsw-unlimit.lst </pre></div> <p><code>DATA/</code> ╟╧└º╡≡╖║┼Σ╕«┐í └º┐í╝¡ ╕╗╟╤ └·└σ╝╥░í └╓┤┘. ╜╟┴ª <strong><em>net.sw</em></strong>└╟ │╗┐δ└║ ║╕┼δ <code>rdist</code>╕ª ╗τ┐δ╟╧┐⌐ └┌╡┐└╕╖╬ ░í┴«┐┬┤┘. ╡╬╣°┬░ ║╬║╨└╠ │▓╛╥┤┘: ╛ε╢╗░╘ └╠ ╡╬ ▒╕┴╢╕ª ╟╧│¬└╟ └┌┐¼╜║╖»┐ε URL ▒╕┴╢╖╬ ┐¼░ß╟╧┤┬░í? ╗τ┐δ└┌┐í░╘ <code>DATA/</code> ╡≡╖║┼Σ╕«╕ª ░¿├▀░φ, URL╕╢┤┘ └√└²╟╤ CGI ╜║┼⌐╕│╞«╕ª ╜╟╟α╟╧░φ ╜═┤┘. ╟╪░ß├Ñ└║ ┤┘└╜░· ░░┤┘: ╕╒└· ╝¡╣÷└╟ <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>┐í╝¡ ░°░│╡╚ URL <code>/net.sw/</code>╕ª │╗║╬ ░µ╖╬ <code>/e/netsw</code>╖╬ └τ└█╝║╟╧▒Γ└º╟╪ ╡≡╖║┼Σ╕«║░ ╝│┴ñ╞─└╧┐í ┤┘└╜░· ░░└╠ ╝│┴ñ╟╤┤┘:</p> <div class="example"><pre> RewriteRule ^net.sw$ net.sw/ [R] RewriteRule ^net.sw/(.*)$ e/netsw/$1 </pre></div> <p>├╣╣°┬░ ▒╘─ó└║ ╕╢┴÷╕╖┐í ╜╜╖í╜¼░í ╛°┤┬ ┐Σ├╗└╗ └º╟╪╝¡ ╗τ┐δ╟▀┤┘! ╡╬╣°┬░ ▒╘─ó└╠ ╜╟┴ª └█╛≈└╗ ╟╤┤┘. ▒╫╕«░φ ╡≡╖║┼Σ╕«║░ ╝│┴ñ╞─└╧ <code>/e/netsw/.www/.wwwacl</code>┐í ░ß┴ñ└√└╬ ╝│┴ñ└╠ │¬┐┬┤┘:</p> <div class="example"><pre> Options ExecCGI FollowSymLinks Includes MultiViews RewriteEngine on # ╛╒ ║╬║╨└╠ /net.sw/ ╖╬ ┴ó▒┘╟╤┤┘ RewriteBase /net.sw/ # ╕╒└· ├╓╗≤└º ╡≡╖║┼Σ╕«╕ª # cgi ╜║┼⌐╕│╞«╖╬ └τ└█╝║╟╤┤┘ RewriteRule ^$ netsw-home.cgi [L] RewriteRule ^index\.html$ netsw-home.cgi [L] # ║Ω╢≤┐∞└·░í ╡≡╖║┼Σ╕«║░ ╞Σ└╠┴÷╕ª ┐Σ├╗╟╤ ░µ┐∞ # ╟╧└º╡≡╖║┼Σ╕«╕ª ├▀├Γ╟╤┤┘ RewriteRule ^.+/(netsw-[^/]+/.+)$ $1 [L] # └╠┴ª └τ└█╝║└╗ ╕╢─ú┤┘ RewriteRule ^netsw-home\.cgi.* - [L] RewriteRule ^netsw-changes\.cgi.* - [L] RewriteRule ^netsw-search\.cgi.* - [L] RewriteRule ^netsw-tree\.cgi$ - [L] RewriteRule ^netsw-about\.html$ - [L] RewriteRule ^netsw-img/.*$ - [L] # ┤┘╕Ñ cgi ╜║┼⌐╕│╞«░í ├│╕«╟╥ # ╟╧└º╡≡╖║┼Σ╕«░í │▓╛╥┤┘ RewriteRule !^netsw-lsdir\.cgi.* - [C] RewriteRule (.*) netsw-lsdir.cgi/$1 </pre></div> <p>╟╪╝«└╗ └º╟╤ ╚∙╞«:</p> <ol> <li>│╫╣°┬░ ║╬║╨┐í╝¡ ┤δ├╝ ╟╩╡σ('<code>-</code>')░í ╛°░φ <code>L</code> (last) ╟├╖í▒╫░í └╓└╜└╗ ┴╓╕±╟╧╢≤</li> <li>╕╢┴÷╕╖ ║╬║╨┐í╝¡ ├╣╣°┬░ ▒╘─ó┐í <code>!</code> (not) ╣«└┌┐═ <code>C</code> (chain) ╟├╖í▒╫╕ª ┴╓╕±╟╧╢≤</li> <li>╕╢┴÷╕╖ ▒╘─ó┐í╝¡ ▒Γ┼╕ ╟╪┤τ╟╧┴÷ ╛╩┤┬ ╕≡╡τ ░µ┐∞╕ª └Γ╛╞│╗┤┬ ╞╨┼╧└╗ ┴╓╕±╟╧╢≤</li> </ol> </dd> </dl> <h3>NCSA imagemap└╗ ╛╞╞──í <code>mod_imap</code>└╕╖╬</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>╗τ╢≈╡Θ└║ NCSA └Ñ╝¡╣÷┐í╝¡ ╟÷┤δ└√└╬ ╛╞╞──í └Ñ╝¡╣÷╖╬ └┌┐¼╜║╖┤░╘ ┐┼░▄░í▒µ ╣┘╢⌡┤┘. ▒╫╖í╝¡ ┐└╖í╡╚ NCSA <code>imagemap</code> ╟┴╖╬▒╫╖Ñ└╗ ╗τ┐δ╟╤ ╞Σ└╠┴÷╕ª ╟÷┤δ└√└╬ ╛╞╞──í <code class="module"><a href="../mod/mod_imap.html">mod_imap</a></code>╖╬ ├│╕«╟╧▒µ ╣┘╢⌡┤┘. ╣«┴ª┤┬ <code>imagemap</code> ╟┴╖╬▒╫╖Ñ└╗ <code>/cgi-bin/imagemap/path/to/page.map</code>░· ░░└╠ ┬ⁿ┴╢╟╧┤┬ ╟╧└╠╞█╕╡┼⌐░í ╕╣┤┘┤┬ ░═└╠┤┘. ╛╞╞──í┤┬ <code>/path/to/page.map</code>░· ░░└║ ┐Σ├╗└╗ ╣▐╛╞╛▀ ╟╤┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╕≡╡τ ┐Σ├╗┐í╝¡ ╛╒║╬║╨└╗ ╡┐└√└╕╖╬ ┴ª░┼╟╧┤┬ └ⁿ┐¬ ▒╘─ó└╗ ╗τ┐δ╟╤┤┘:</p> <div class="example"><pre> RewriteEngine on RewriteRule ^/cgi-bin/imagemap(.*) $1 [PT] </pre></div> </dd> </dl> <h3>┐⌐╖» ╡≡╖║┼Σ╕«┐í╝¡ ╞Σ└╠┴÷ ░╦╗÷</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>░í▓√ └Ñ╝¡╣÷░í ┐⌐╖» ╡≡╖║┼Σ╕«┐í╝¡ ╞─└╧└╗ ├ú╛╞╛▀ ╟╥ ╢º░í └╓┤┘. └╠ ░µ┐∞ MultiViews│¬ ┤┘╕Ñ ╣µ╣²└║ ╡╡┐≥└╠ ╛╚╡╚┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>┐⌐╖» ╡≡╖║┼Σ╕«┐í╝¡ ╞─└╧└╗ ├ú┤┬ ▒╘─ó└╗ ┴≈┴ó ╟┴╖╬▒╫╖Ñ╟╤┤┘.</p> <div class="example"><pre> RewriteEngine on # ╕╒└· custom/┐í╝¡ ├ú▒µ ╜├╡╡╟╧░φ... # ...├ú└╕╕Θ │í! RewriteCond /your/docroot/<strong>dir1</strong>/%{REQUEST_FILENAME} -f RewriteRule ^(.+) /your/docroot/<strong>dir1</strong>/$1 [L] # ╡╬╣°┬░╖╬ pub/┐í╝¡ ├ú▒µ ╜├╡╡╟╤┤┘... # ...├ú└╕╕Θ │í! RewriteCond /your/docroot/<strong>dir2</strong>/%{REQUEST_FILENAME} -f RewriteRule ^(.+) /your/docroot/<strong>dir2</strong>/$1 [L] # ╕°├ú└╕╕Θ ┤┘╕Ñ Alias│¬ ScriptAlias ┴÷╜├╛ε ╡ε└╕╖╬ ┴°╟α╟╤┤┘. RewriteRule ^(.+) - [PT] </pre></div> </dd> </dl> <h3>URL┐í ╡√╢≤ ╚»░µ║»╝÷╕ª ╝│┴ñ╟╤┤┘</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>┐Σ├╗╡Θ░ú┐í ╗≤┼┬┴ñ║╕╕ª └»┴÷╟╧▒Γ└º╟╪ URL┐í ┴ñ║╕╕ª └╬─┌╡∙╟╧┤┬ ╣µ╣²╡╡ └╓┤┘. ▒╫╖»│¬ ┤▄┴÷ └╠ ┴ñ║╕╕ª ┴ª░┼╟╧▒Γ└º╟╪ ╕≡╡τ ╞Σ└╠┴÷┐í CGI wrapper╕ª ╗τ┐δ╟╧░φ ╜═┴÷ ╛╩┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>└τ└█╝║ ▒╘─ó└╗ ╗τ┐δ╟╧┐⌐ ╗≤┼┬┴ñ║╕╕ª ├▀├Γ╟╧░φ, ├▀├Γ╟╤ ┴ñ║╕╕ª │¬┴▀┐í XSSI│¬ CGI┐í╝¡ ╗τ┐δ╟╧▒Γ└º╟╪ ╚»░µ║»╝÷┐í └·└σ╟╤┤┘. ▒╫╖í╝¡ URL <code>/foo/S=java/bar/</code>┤┬ <code>/foo/bar/</code>╖╬ ║»╚»╡╟░φ <code>STATUS</code>╢≤┤┬ ╚»░µ║»╝÷ ░¬└╗ "java"╖╬ ╝│┴ñ╟╤┤┘.</p> <div class="example"><pre> RewriteEngine on RewriteRule ^(.*)/<strong>S=([^/]+)</strong>/(.*) $1/$3 [E=<strong>STATUS:$2</strong>] </pre></div> </dd> </dl> <h3>░í╗≤ ╗τ┐δ└┌ ╚ú╜║╞«</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>░í╗≤╚ú╜║╞«╕ª ╗τ┐δ╟╧┴÷ ╛╩░φ ░░└║ ──╟╗┼═╖╬ DNS A ╖╣─┌╡σ╕ª ╝│┴ñ╟╧┐⌐ <code>www.<strong>username</strong>.host.domain.com</code>└╗ ╗τ┐δ└┌└╟ ╚¿╞Σ└╠┴÷╖╬ ┴ª░°╟╧░φ ╜═┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>HTTP/1.0 ┐Σ├╗└╟ ░µ┐∞ ╣µ╣²└╠ ╛°┴÷╕╕, Host: HTTP ╟∞┤⌡╕ª ╞≈╟╘╟╤ HTTP/1.1 ┐Σ├╗└║ ┤┘└╜ ▒╘─ó└╗ ╗τ┐δ╟╧┐⌐ │╗║╬└√└╕╖╬ <code>http://www.username.host.com/anypath</code>╕ª <code>/home/username/anypath</code>╖╬ └τ└█╝║╟╥ ╝÷ └╓┤┘:</p> <div class="example"><pre> RewriteEngine on RewriteCond %{<strong>HTTP_HOST</strong>} ^www\.<strong>[^.]+</strong>\.host\.com$ RewriteRule ^(.+) %{HTTP_HOST}$1 [C] RewriteRule ^www\.<strong>([^.]+)</strong>\.host\.com(.*) /home/<strong>$1</strong>$2 </pre></div> </dd> </dl> <h3>╚¿╡≡╖║┼Σ╕«╕ª ┐▄║╬ ╝¡╣÷╖╬ ╕«┤┘└╠╖║╝╟</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>┴÷┐¬ ╡╡╕▐└╬ <code>ourdomain.com</code> ╣█┐í╝¡ ┐Σ├╗└╠ ╡Θ╛ε┐└╕Θ ╚¿╡≡╖║┼Σ╕« URL└╗ ┤┘╕Ñ └Ñ╝¡╣÷ <code>www.somewhere.com</code>└╕╖╬ ╕«┤┘╕«╖║╝╟╟╧▒µ ╣┘╢⌡┤┘. ┴╛┴╛ ░í╗≤╚ú╜║╞« ╗τ┐δ└σ╝╥┐í╝¡ ╗τ┐δ╟╤┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>└τ└█╝║ ┴╢░╟└╗ ╗τ┐δ╟╧╕Θ ╡╚┤┘:</p> <div class="example"><pre> RewriteEngine on RewriteCond %{REMOTE_HOST} <strong>!^.+\.ourdomain\.com$</strong> RewriteRule ^(/~.+) http://www.somewhere.com/$1 [R,L] </pre></div> </dd> </dl> <h3>╜╟╞╨╟╤ URL└╗ ┤┘╕Ñ └Ñ╝¡╣÷╖╬ ╕«┤┘└╠╖║╝╟</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>URL └τ└█╝║┐í ┤δ╟╪╝¡ └Ñ╝¡╣÷ A┐í ╟╪┤τ ╞─└╧└╠ ╛°┤┬ ░µ┐∞ └Ñ╝¡╣÷ B╖╬ ┐Σ├╗└╗ ╕«┤┘└╠╖║╝╟╟╧┤┬ ╣µ╣²└╗ └┌┴╓ ╣░╛ε║╗┤┘. ║╕┼δ Perl╖╬ └█╝║╟╤ <code class="directive"><a href="../mod/core.html#errordocument">ErrorDocument</a></code> CGI ╜║┼⌐╕│╞«╕ª ╗τ┐δ╟╧┴÷╕╕, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>╕ª ╗τ┐δ╟╧┤┬ ╣µ╣²╡╡ └╓┤┘. ▒╫╖»│¬ ╝║┤╔└║ <code class="directive"><a href="../mod/core.html#errordocument">ErrorDocument</a></code> CGI ╜║┼⌐╕│╞«║╕┤┘ ╢│╛ε┴ⁿ└╗ ╕φ╜╔╟╧╢≤!</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>├╣╣°┬░ ╣µ╣²└║ ║ⁿ╕ú┴÷╕╕ └»┐¼╝║└╠ ╢│╛ε┴÷░φ ┐╧└ⁿ╟╧┴÷ ╛╩┤┘:</p> <div class="example"><pre> RewriteEngine on RewriteCond /your/docroot/%{REQUEST_FILENAME} <strong>!-f</strong> RewriteRule ^(.+) http://<strong>webserverB</strong>.dom/$1 </pre></div> <p>└╠ ╣µ╣²└╟ ┤▄┴í└║ <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> ╛╚┐í └╓┤┬ ╞Σ└╠┴÷╕╕ ░í┤╔╟╧┤┘┤┬ ┴í└╠┤┘. (┐╣╕ª ╡Θ╛ε ╚¿╡≡╖║┼Σ╕« ╡ε└╗ └º╟╪) ┴╢░╟└╗ ├▀░í╟╥ ╝÷ └╓┴÷╕╕, ┤⌡ ┴┴└║ ╣µ╣²└╠ └╓┤┘:</p> <div class="example"><pre> RewriteEngine on RewriteCond %{REQUEST_URI} <strong>!-U</strong> RewriteRule ^(.+) http://<strong>webserverB</strong>.dom/$1 </pre></div> <p><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>└╟ URL └ⁿ╣µ┬ⁿ┴╢(look-ahead)╕ª ╗τ┐δ╟╤┤┘. ▒╫╖í╝¡ ╕≡╡τ URL┐í ╡┐└█╟╧░φ ╛╚└ⁿ╟╧┤┘. ▒╫╖»│¬ ╕≡╡τ ┐Σ├╗╕╢┤┘ │╗║╬ ╟╧└º┐Σ├╗└╗ ╟╤╣° ┤⌡ ╟╧▒Γ╢º╣«┐í └Ñ╝¡╣÷ ╝║┤╔┐í ╛╟┐╡╟Γ└╗ ┴╪┤┘. ▒╫╖í╝¡ ░¡╖┬╟╤ CPU┐í╝¡ └Ñ╝¡╣÷╕ª ╜╟╟α╟╤┤┘╕Θ ╗τ┐δ╟╧╢≤. ──╟╗┼═░í ┤└╕«┤┘╕Θ ├╣╣°┬░ ╣µ╣²└╠│¬ ┤⌡ │¬└║ <code class="directive"><a href="../mod/core.html#errordocument">ErrorDocument</a></code> CGI ╜║┼⌐╕│╞«╕ª ╗τ┐δ╟╧╢≤.</p> </dd> </dl> <h3>╚«└σ ╕«┤┘└╠╖║╝╟</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>░í▓√ ╕«┤┘└╠╖║╝╟╟╧┤┬ URL└╗ ┤⌡ ┴╢└²╟╥ ╟╩┐Σ░í └╓┤┘. ╛╞╞──í │╗║╬ URL escape ╟╘╝÷┤┬ "<code>url#anchor</code>" ░░└║ URL└╟ anchor╡╡ escape╟╤┤┘. ╛╞╞──í└╟ <code>uri_escape()</code> ╟╘╝÷┤┬ ┐∞╣░┴ñ└┌(#)╡╡ ░░└╠ escape╟╧╣╟╖╬ ╗τ┐δ╟╥ ╝÷ ╛°┤┘. ▒╫╖»╕Θ ╛ε╢╗░╘ └╠╖▒ URL╖╬ ╕«┤┘└╠╖║╝╟╟╥ ╝÷ └╓│¬?</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>┴≈┴ó ╕«┤┘└╠╖║╝╟╟╧┤┬ NPH-CGI ╜║┼⌐╕│╞«╕ª ╗τ┐δ╟╤ ╟╪░ß├Ñ└╠ ╟╩┐Σ╟╧┤┘. escape╕ª ╟╧┴÷ ╛╩▒Γ╢º╣«└╠┤┘ (NPH=non-parseable headers). ╕╒└· ┤┘└╜ ╝¡╣÷╝│┴ñ└╗ ╟╧┐⌐ (└τ└█╝║ ▒╘─ó└╟ │í║╬║╨┐í ╗τ┐δ╟╪╛▀ ╟╤┤┘) ╗⌡╖╬┐ε URL scheme <code>xredirect:</code>╕ª ╡╡└╘╟╤┤┘:</p> <div class="example"><pre> RewriteRule ^xredirect:(.+) /path/to/nph-xredirect.cgi/$1 \ [T=application/x-httpd-cgi,L] </pre></div> <p>▒╫╖»╕Θ <code>xredirect:</code>╖╬ ╜├└█╟╧┤┬ ╕≡╡τ URL└║ <code>nph-xredirect.cgi</code> ╟┴╖╬▒╫╖Ñ└╗ ┼δ╟╧░╘ ╡╚┤┘. ╟┴╖╬▒╫╖Ñ└║ ┤┘└╜░· ░░┤┘:</p> <div class="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></div> <p>▒╫╖»╕Θ <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>░í ┴≈┴ó ╣▐┴÷╕°╟╧┤┬ ╕≡╡τ URL scheme└╕╖╬ ╕«┤┘└╠╖║╝╟╟╥ ╝÷ └╓┤┘. ┐╣╕ª ╡Θ╛ε, ┤┘└╜░· ░░└╠ <code>news:newsgroup</code>└╕╖╬ ╕«┤┘└╠╖║╝╟╟╥ ╝÷ └╓┤┘</p> <div class="example"><pre> RewriteRule ^anyurl xredirect:news:newsgroup </pre></div> <div class="note">┴╓└╟: └º└╟ ╞»║░╟╤ "┼δ░·" ▒╘─ó└╗ ╗τ┐δ╟╧┐⌐ <code>xredirect:</code>╕ª ╕╢┴÷╕╖┐í ╚«└σ╟╪╛▀ ╟╧▒Γ╢º╣«┐í ▒╘─ó┐í <code>[R]</code>└╠│¬ <code>[R,L]</code>└╗ ╗τ┐δ╟╧╕Θ ╛╚╡╚┤┘.</div> </dd> </dl> <h3>└·└σ╝╥ ┴ó▒┘ ┴▀░Φ(multiplexer)</h3> <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 ╜║┼⌐╕│╞«╕ª ╗τ┐δ╟╧┴÷╕╕, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>╕ª ╗τ┐δ╟╧┐⌐ ║±╜┴╟╧░╘ ╕╕╡Θ ╝÷ └╓└╗▒ε?</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╕╒└· <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> 3.0.0 ╣÷└ⁿ║╬┼═ ╕«┤┘└╠╖║╝╟┐í "<code>ftp:</code>" scheme└╗ ╗τ┐δ╟╥ ╝÷ └╓┤┘. ┤┘└╜└╕╖╬ ┼¼╢≤└╠╛≡╞«└╟ ├╓╗≤└º ╡╡╕▐└╬└╗ <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>░· ░░└╠ ╗τ┐δ╟╧┐⌐ └º─í╕ª ├▀┴ñ╟╥ ╝÷ └╓┤┘. ║╣└Γ╚≈ ┐½└╬ ▒╘─ó┐í╝¡ ├╓╗≤└º ╡╡╕▐└╬└╗ ┴▀░Φ╕╩└╟ ┼░╖╬ ╗τ┐δ╟╤┤┘.</p> <div class="example"><pre> RewriteEngine on RewriteMap multiplex txt:/path/to/map.cxan RewriteRule ^/CxAN/(.*) %{REMOTE_HOST}::$1 [C] RewriteRule ^.+\.<strong>([a-zA-Z]+)</strong>::(.*)$ ${multiplex:<strong>$1</strong>|ftp.default.dom}$2 [R,L] </pre></div> <div class="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></div> </dd> </dl> <h3>╜├░ú┐í ╡√╕Ñ └τ└█╝║</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>╜├░ú┐í ╡√╢≤ ┤┘╕Ñ │╗┐δ└╗ ╝¡║±╜║╟╧┤┬ ░µ┐∞ ╕╣└║ └Ñ░ⁿ╕«└┌┤┬ └ß╜├ ╞»║░╟╤ ╞Σ└╠┴÷╖╬ ╕«┤┘└╠╖║╝╟╟╧▒Γ└º╟╪ CGI ╜║┼⌐╕│╞«╕ª ╗τ┐δ╟╤┤┘. <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>╖╬┤┬ ╛ε╢╗░╘ ╟╥ ╝÷ └╓┤┬░í?</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>└τ└█╝║ ┴╢░╟┐í╝¡ ╗τ┐δ╟╥ ╝÷ └╓┤┬ ┐⌐╖» <code>TIME_xxx</code> ║»╝÷░í └╓┤┘. ║»╝÷┐═ ╞»║░╟╤ ╗τ└ⁿ╝°╝¡ ║±▒│ <code><STRING</code>, <code>>STRING</code>, <code>=STRING</code>└╗ ╗τ┐δ╟╧┐⌐ ╜├░ú┐í ╡√╢≤ ╕«┤┘└╠╖║╝╟╟╥ ╝÷ └╓┤┘:</p> <div class="example"><pre> RewriteEngine on RewriteCond %{TIME_HOUR}%{TIME_MIN} >0700 RewriteCond %{TIME_HOUR}%{TIME_MIN} <1900 RewriteRule ^foo\.html$ foo.day.html RewriteRule ^foo\.html$ foo.night.html </pre></div> <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> <h3>YYYY╕ª XXXX╖╬ └╠└ⁿ╟╤ ░µ┐∞ ┐¬╚ú╚»</h3> <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> <div class="example"><pre> # ╣«╝¡.html └╠ ╛°░φ # ╣«╝¡.phtml ╕╕ └╓┤┬ ░µ┐∞ # ╣«╝¡.html └╗ ╣«╝¡.phtml ╖╬ # └τ└█╝║╟╧┤┬ ┐¬╚ú╚» ▒╘─ó RewriteEngine on RewriteBase /~quux/ # ▒Γ║╗└╠╕º└╗ ├ú░φ, ├ú╛╥┤┘┤┬ ╗τ╜╟└╗ ▒Γ╛∩╟╤┤┘ RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes] # ╞─└╧└╠ └╓┤┘╕Θ ╣«╝¡.phtml ╖╬ └τ└█╝║╟╤┤┘ RewriteCond %{REQUEST_FILENAME}.phtml -f RewriteRule ^(.*)$ $1.phtml [S=1] # ╛╞┤╧╕Θ ╛╒┐í╝¡ ├ú└║ ▒Γ║╗└╠╕º└╗ ╡╟╡╣╕░┤┘ RewriteCond %{ENV:WasHTML} ^yes$ RewriteRule ^(.*)$ $1.html </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="content" id="content">─┴┼┘├≈ ┤┘╖τ▒Γ</a></h2> <h3>╗⌡╖╬ └╠└ⁿ (░¿├▀▒Γ)</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>├╓▒┘ <code>foo.html</code>└╗ <code>bar.html</code>╖╬ ║»░µ╟╧░φ ┐¬╚ú╚»╝║└╗ └º╟╪ └╠└ⁿ URL└╗ ░Φ╝╙ ┴ª░°╟╧░φ ╜═┤┘░φ ░í┴ñ╟╧└┌. ╗τ┐δ└┌┤┬ └╠└ⁿ URL└╠ ║»░µ╡╟╛·┤┘┤┬ ╗τ╜╟└╗ ┤½─í├ñ┴÷ ╕°╟╤┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>┤┘└╜ ▒╘─ó└╕╖╬ └╠└ⁿ URL└╗ │╗║╬└√└╕╖╬ ╗⌡╖╬┐ε URL╖╬ └τ└█╝║╟╤┤┘:</p> <div class="example"><pre> RewriteEngine on RewriteBase /~quux/ RewriteRule ^<strong>foo</strong>\.html$ <strong>bar</strong>.html </pre></div> </dd> </dl> <h3>╗⌡╖╬ └╠└ⁿ (╛╦╕«▒Γ)</h3> <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> <div class="example"><pre> RewriteEngine on RewriteBase /~quux/ RewriteRule ^<strong>foo</strong>\.html$ <strong>bar</strong>.html [<strong>R</strong>] </pre></div> </dd> </dl> <h3>║Ω╢≤┐∞└·┐í ╡√╕Ñ │╗┐δ</h3> <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> <div class="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></div> </dd> </dl> <h3>╡┐└√ ╣╠╖»</h3> <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> <div class="example"><pre> RewriteEngine on RewriteBase /~quux/ RewriteRule ^<strong>hotsheet/</strong>(.*)$ <strong>http://www.tstimpreso.com/hotsheet/</strong>$1 [<strong>P</strong>] </pre></div> <div class="example"><pre> RewriteEngine on RewriteBase /~quux/ RewriteRule ^<strong>usa-news\.html</strong>$ <strong>http://www.quux-corp.com/news/index.html</strong> [<strong>P</strong>] </pre></div> </dd> </dl> <h3>╡┐└√ ┐¬╣╠╖»</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd>...</dd> <dt>╟╪░ß├Ñ:</dt> <dd> <div class="example"><pre> RewriteEngine on RewriteCond /mirror/of/remotesite/$1 -U RewriteRule ^http://www\.remotesite\.com/(.*)$ /mirror/of/remotesite/$1 </pre></div> </dd> </dl> <h3>╛°┤┬ └┌╖ß╕ª └╬╞«╢≤│▌┐í╝¡ ░í┴«┐└▒Γ</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>╜╟┴ª └┌╖ß╕ª ╣µ╚¡║«└╠ ║╕╚ú╟╧┤┬ (│╗║╬) └╬╞«╢≤│▌ └Ñ╝¡╣÷┐í (<code>www2.quux-corp.dom</code>) └·└σ╟╧╕Θ╝¡, ▒Γ╛≈└╟ (┐▄║╬) └╬┼═│▌ └Ñ╝¡╣÷╕ª (<code>www.quux-corp.dom</code>) ╜╟╟α╟╧┤┬ ░═├│╖│ ║╕└╠░╘ ╟╤┤┘. ┐▄║╬ └Ñ╝¡╣÷┤┬ ┐Σ├╗╟╤ └┌╖ß╕ª │╗║╬ └Ñ╝¡╣÷┐í╝¡ ░í┴«┐┬┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╕╒└· ╣µ╚¡║«└╠ │╗║╬ └Ñ╝¡╣÷╕ª ║╕╚ú╟╧░φ ┐▄║╬ └Ñ╝¡╣÷╕╕└╠ │╗║╬ └Ñ╝¡╣÷┐í╝¡ └┌╖ß╕ª ╛≥└╗ ╝÷ └╓░╘ ╟╤┤┘. ┤┘└╜░· ░░└╠ ╞╨┼╢╟╩┼═╕╡ ╣µ╚¡║«└╗ ╝│┴ñ╟╤┤┘:</p> <div class="example"><pre> <strong>ALLOW</strong> Host www.quux-corp.dom Port >1024 --> Host www2.quux-corp.dom Port <strong>80</strong> <strong>DENY</strong> Host * Port * --> Host www2.quux-corp.dom Port <strong>80</strong> </pre></div> <p>╜╟┴ª ╝│┴ñ╣«╣²┐í ╛╦╕┬░╘ ░φ├─╢≤. ╛°┤┬ └┌╖ß╕ª │╗║╬└√└╕╖╬ proxy throughput ▒Γ┤╔└╗ ┼δ╟╪ ┐Σ├╗╟╧┤┬ <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> ▒╘─ó└╗ └█╝║╟╤┤┘:</p> <div class="example"><pre> RewriteRule ^/~([^/]+)/?(.*) /home/$1/.www/$2 RewriteCond %{REQUEST_FILENAME} <strong>!-f</strong> RewriteCond %{REQUEST_FILENAME} <strong>!-d</strong> RewriteRule ^/home/([^/]+)/.www/?(.*) http://<strong>www2</strong>.quux-corp.dom/~$1/pub/$2 [<strong>P</strong>] </pre></div> </dd> </dl> <h3>╖╬╡σ╣δ╖▒╜╠ (║╬╟╧ ║╨╗Ω╟╧▒Γ)</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p><code>www.foo.com</code>└╟ ┼δ╜┼╖«└╗ <code>www[0-5].foo.com</code> (├╤ ╝¡╣÷ 6┤δ)└╕╖╬ ║╨╗Ω╟╧░φ ╜═┤┘. ╛ε╢╗░╘ ╟╧┤┬░í?</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╕┼┐∞ ┤┘╛τ╟╤ ╣µ╣²└╕╖╬ └╠ ╣«┴ª╕ª ╟╪░ß╟╥ ╝÷ └╓┤┘. ╕╒└· DNS╕ª ╗τ┐δ╟╤ └▀ ╛╦╖┴┴° ╣µ╣²└╗ ╝│╕φ╟╧░φ, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>╕ª ╗τ┐δ╟╧┤┬ ░µ┐∞╕ª ╗∞╞∞║╕└┌:</p> <ol> <li> <strong>DNS Round-Robin</strong> <p>░í└σ ░ú┤▄╟╤ ╖╬╡σ╣δ╖▒╜╠ ╣µ╣²└║ <code>BIND</code>└╟ DNS round-robin ╣µ╜─└╗ ╗τ┐δ╟╧┤┬ ░═└╠┤┘. ┤┘└╜░· ░░└╠ DNS A(address) ╖╣─┌╡σ┐í <code>www[0-9].foo.com</code>└╗ ╝│┴ñ╟╤┤┘.</p> <div class="example"><pre> www0 IN A 1.2.3.1 www1 IN A 1.2.3.2 www2 IN A 1.2.3.3 www3 IN A 1.2.3.4 www4 IN A 1.2.3.5 www5 IN A 1.2.3.6 </pre></div> <p>▒╫╕«░φ ┤┘└╜ ╟╫╕±└╗ ├▀░í╟╤┤┘:</p> <div class="example"><pre> www IN CNAME www0.foo.com. IN CNAME www1.foo.com. IN CNAME www2.foo.com. IN CNAME www3.foo.com. IN CNAME www4.foo.com. IN CNAME www5.foo.com. IN CNAME www6.foo.com. </pre></div> <p>└▀╕°╡╚ ░═├│╖│ ║╕└╠┴÷╕╕, ╜╟┴ª╖╬ <code>BIND</code>└╟ └╟╡╡╡╚ ▒Γ┤╔└╠┤┘. └╠┴ª <code>www.foo.com</code>└╗ ├ú└╕╕Θ, <code>BIND</code>┤┬ ╕┼╣° ╝°╝¡╕ª ┴╢▒▌╛┐ ╣┘▓π░í╕τ <code>www0-www6</code>└╗ ╣▌╚»╟╤┤┘. ▒╫╖í╝¡ ┼¼╢≤└╠╛≡╞«╡Θ└╗ ┐⌐╖» ╝¡╣÷╖╬ ║╨╗Ω╟╤┤┘. ▒╫╖»│¬ DNS ░╦╗÷ ░ß░·░í │╫╞«┐≈└╟ ┤┘╕Ñ │╫└╙╝¡╣÷┐í ─│╜¼╡╟┐⌐ <code>www.foo.com</code>└╗ ├ú└║ ░ß░·░í ╞»┴ñ <code>wwwN.foo.com</code>└╠╕Θ ┼¼╢≤└╠╛≡╞«└╟ ┤┘└╜ ┐Σ├╗╡Θ╡╡ ░░└║ <code>wwwN.foo.com</code>└╕╖╬ ║╕│╗┴÷▒Γ╢º╣«┐í ┐╧║«╟╤ ╖╬╡σ╣δ╖▒╜╠ ▒Γ╣²└╠ ╛╞┤╘└╗ ┴╓└╟╟╧╢≤. ▒╫╖»│¬ ┼⌐░╘ ║╕╕Θ ┐Σ├╗└╠ ┐⌐╖» └Ñ╝¡╣÷┐í ║╨╗Ω╡╟╣╟╖╬ ╚┐░·░í ┴┴┤┘.</p> </li> <li> <strong>DNS ╖╬╡σ╣δ╖▒╜╠</strong> <p><a href="http://www.stanford.edu/~schemers/docs/lbnamed/lbnamed.html">http://www.stanford.edu/~schemers/docs/lbnamed/lbnamed.html</a>┐í └╓┤┬ <code>lbnamed</code> ╟┴╖╬▒╫╖Ñ└╗ ╗τ┐δ╟╧┐⌐ ┴ñ▒│╟╤ DNS▒Γ╣▌ ╖╬╡σ╣δ╖▒╜╠└╗ ╟╥ ╝÷ └╓┤┘. DNS░í ╜╟┴ª ╖╬╡σ╣δ╖▒╜╠└╗ ╟╧╡╡╖╧ ╕╕╡σ┤┬ ┐⌐╖» ╡╡▒╕┐═ Perl 5 ╟┴╖╬▒╫╖Ñ└╠┤┘.</p> </li> <li> <strong>Proxy Throughput Round-Robin</strong> <p>└╠ ╣µ╣²└║ <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>┐═ proxy throughput ▒Γ┤╔└╗ ╗τ┐δ╟╤┤┘. ╕╒└· DNS┐í ┤┘└╜ ╟╫╕±└╗ ╗τ┐δ╟╧┐⌐ <code>www0.foo.com</code>└╠ ╜╟┴ª <code>www.foo.com</code>└╗ └ⁿ┤π╟╧░╘ ╟╤┤┘</p> <div class="example"><pre> www IN CNAME www0.foo.com. </pre></div> <p>▒╫╕«░φ <code>www0.foo.com</code>└╗ ╟┴╖╧╜├└ⁿ┐δ ╝¡╣÷╖╬ ║»░µ╟╤┤┘. ┴∩, URL└╗ ╣▐└╕╕Θ ╝¡╣÷┤┬ │╗║╬ ╟┴╖╧╜├╕ª ┼δ╟╪ ┤┘╕Ñ 5┤δ ╝¡╣÷┴▀ (<code>www1-www5</code>) ╟╤┤δ╖╬ ║╕│╗▒Γ╕╕ ╟╤┤┘. └╠╕ª └º╟╪ ╕╒└· ╕≡╡τ URL└╗ ╖╬╡σ╣δ╖▒╜╠ ╜║┼⌐╕│╞« <code>lb.pl</code>╖╬ ║╕│╗┤┬ ▒╘─ó└╗ ╕╕╡τ┤┘.</p> <div class="example"><pre> RewriteEngine on RewriteMap lb prg:/path/to/lb.pl RewriteRule ^/(.+)$ ${lb:$1} [P,L] </pre></div> <p><code>lb.pl</code>└╗ └█╝║╟╤┤┘:</p> <div class="example"><pre> #!/path/to/perl ## ## lb.pl -- ╖╬╡σ╣δ╖▒╜╠ ╜║┼⌐╕│╞« ## $| = 1; $name = "www"; # ▒Γ║╗ ╚ú╜║╞«╕φ $first = 1; # ├╣╣°┬░ ╝¡╣÷ (└┌╜┼└╠ 0└╠▒Γ ╢º╣«┐í, 0└╗ ╗τ┐δ╟╧┴÷ ╛╩┤┬┤┘) $last = 5; # round-robin┐í╝¡ ╕╢┴÷╕╖ ╝¡╣÷ $domain = "foo.dom"; # ╡╡╕▐└╬╕φ $cnt = 0; while (<STDIN>) { $cnt = (($cnt+1) % ($last+1-$first)); $server = sprintf("%s%d.%s", $name, $cnt+$first, $domain); print "http://$server/$_"; } ##EOF## </pre></div> <div class="note">╕╢┴÷╕╖ ┴╓└╟: ┐╓ └╠ ╣µ╣²└╠ └»┐δ╟╤░í? <code>www0.foo.com</code>┐í ║╬┤π└╠ ░í┴÷╛╩┤┬░í? ╣░╖╨, ║╬┤π└╠ ╡╚┤┘. ▒╫╖»│¬ ┤▄╝°╟╤ proxy throughput ┐Σ├╗╕╕ ╟╧▒Γ╢º╣«┐í ▒ª┬·┤┘! ╕≡╡τ SSI, CGI, ePerl ╡ε└║ └ⁿ└√└╕╖╬ ┤┘╕Ñ ╝¡╣÷░í ├│╕«╟╤┤┘. └╠░═└╠ ╟┘╜╔└╠┤┘.</div> </li> <li> <strong>╟╧╡σ┐■╛ε/TCP Round-Robin</strong> <p>╟╧╡σ┐■╛ε╕ª ╗τ┐δ╟╤ ╟╪░ß├Ñ╡╡ └╓┤┘. Cisco┤┬ TCP/IP ╝÷┴╪┐í╝¡ ╖╬╡σ╣δ╖▒╜╠└╗ ╟╧┤┬ LocalDirector╢≤┤┬ ▒½╣░└╗ ╞╟┤┘. ╜╟┴ª╖╬┤┬ └Ñ╝¡╣÷▒║ ╛╒┤▄┐í └º─í╟╧┤┬ └╧┴╛└╟ ╚╕╖╬╝÷┴╪ ░╘└╠╞«┐■└╠┤┘. └┌▒▌└╠ ├µ║╨╟╧░φ ░φ╝║┤╔ ╟╪░ß├Ñ└╠ ╟╩┐Σ╟╧┤┘╕Θ └╠░═└╗ ╗τ┐δ╟╧╢≤.</p> </li> </ol> </dd> </dl> <h3>╗⌡╖╬┐ε MIME-type, ╗⌡╖╬┐ε ╝¡║±╜║</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>│╫╞«┐≈┐í┤┬ ╕┌┴° CGI ╟┴╖╬▒╫╖Ñ╡Θ└╠ ╕╣┤┘. ▒╫╖»│¬ ╗τ┐δ╟╧▒Γ ╣°░┼╖»┐÷╝¡ ╕╣└║ └Ñ░ⁿ╕«└┌░í ╗τ┐δ╟╧┴÷ ╛╩┤┬┤┘. ╛╞╞──í└╟ MIME-type┐í ╡√╕Ñ Action ╟┌╡Θ╖» ▒Γ┤╔╡╡ CGI ╟┴╖╬▒╫╖Ñ└╠ ╞»║░╟╤ URL└╗ (┴ñ╚«╚≈ <code>PATH_INFO</code>┐═ <code>QUERY_STRINGS</code>) ╟┴╖╬▒╫╖Ñ└╟ └╘╖┬└╕╖╬ ╗τ┐δ╟╧┴÷ ╛╩└╗ ╢º╕╕ └√└²╟╧┤┘. ╕╒└·, ╚«└σ└┌░í (secure CGI╕ª ┴┘┐⌐) <code>.scgi</code>└╬ ╞─└╧└╗ └»╕φ╟╤ <code>cgiwrap</code> ╟┴╖╬▒╫╖Ñ└╕╖╬ ├│╕«╟╧▒Γ└º╟╪ ╗⌡╖╬┐ε type└╗ ╝│┴ñ╟╤┤┘. ╣«┴ª┤┬ (└º┐í╝¡ ║╗) └╧░ⁿ╡╚ URL ▒╕┴╢╕ª ╗τ┐δ╟╧┤┬ ░µ┐∞ ╗τ┐δ└┌ ╚¿╡≡╖║┼Σ╕«░í <code>/u/user/foo/bar.scgi</code>░░└║ URL└╬ ┴í└╠┤┘. <code>cgiwrap</code>┤┬ <code>/~user/foo/bar.scgi/</code> ╟ⁿ╜─└╟ URL└╗ ┐°╟╧▒Γ╢º╣«└╠┤┘. ┤┘└╜ ▒╘─ó└╠ ╣«┴ª╕ª ╟╪░ß╟╤┤┘:</p> <div class="example"><pre> RewriteRule ^/[uge]/<strong>([^/]+)</strong>/\.www/(.+)\.scgi(.*) ... ... /internal/cgi/user/cgiwrap/~<strong>$1</strong>/$2.scgi$3 [NS,<strong>T=application/x-http-cgi</strong>] </pre></div> <p>└╠┴ª ┤┘╕Ñ ╕┌┴° ╟┴╖╬▒╫╖Ñ, (URL ╟╧└º╞«╕«┐í ┤δ╟╤ <code>access.log</code>╕ª ├Γ╖┬╟╧┤┬) <code>wwwlog</code>┐═ (URL ╟╧└º╞«╕«┐í Glimpse╕ª ╜╟╟α╟╧┤┬) <code>wwwidx</code>░í └╓┤┘░φ ░í┴ñ╟╧└┌. ┐∞╕«┤┬ ╟┴╖╬▒╫╖Ñ┐í░╘ └█╛≈╟╥ ┤δ╗≤└╬ URL ┐╡┐¬└╗ ╛╦╖┴┴α╛▀ ╟╤┤┘. ▒╫╖»│¬ ┐Σ├╗╟╥╢º╕╢┤┘ ╟╫╗≤ └√╛ε┴α╛▀ ╟╧▒Γ╢º╣«┐í ▒≥▓√╟╧┴÷ ╛╩┤┘. ┴∩, ║╕┼δ <code>/u/user/foo/</code>┐í ┤δ╟╪ <code>swwidx</code> ╟┴╖╬▒╫╖Ñ└╗ ╜╟╟α╟╤┤┘╕Θ ┤┘└╜░· ░░└║ ╕╡┼⌐╕ª ╗τ┐δ╟╤┤┘</p> <div class="example"><pre> /internal/cgi/user/swwidx?i=/u/user/foo/ </pre></div> <p>▒≥▓√╟╧┴÷ ╛╩┤┘. ╕╡┼⌐┐í ┐╡┐¬└╟ └º─í<strong>┐═</strong> CGI └º─í╕ª <strong>╕≡╡╬</strong> └√╛ε╛▀ ╟╧▒Γ╢º╣«└╠┤┘. ┐╡┐¬└╗ └τ▒╕╝║╟╤┤┘╕Θ ┐⌐╖» ╟╧└╠╞█╕╡┼⌐╕ª ╝÷┴ñ╟╧┤┬╡Ñ ╕╣└║ ╜├░ú└╠ ░╔╕▒ ░═└╠┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╟╪░ß├Ñ└║ └┌╡┐└╕╖╬ └√└²╟╤ CGI╕ª ╜╟╟α╟╧┤┬ ╗⌡╖╬┐ε ╞»║░╟╤ URL ╟ⁿ╜─└╗ ╕╕╡σ┤┬ ░═└╠┤┘. ┤┘└╜░· ░░└╠ ╝│┴ñ╟╤┤┘:</p> <div class="example"><pre> RewriteRule ^/([uge])/([^/]+)(/?.*)/\* /internal/cgi/user/wwwidx?i=/$1/$2$3/ RewriteRule ^/([uge])/([^/]+)(/?.*):log /internal/cgi/user/wwwlog?f=/$1/$2$3 </pre></div> <p>└╠┴ª <code>/u/user/foo/</code>└╗ ░╦╗÷╟╧┤┬ ╕╡┼⌐┤┬ ┤┘└╜░· ░░┤┘</p> <div class="example"><pre> HREF="*" /u/user/foo/* (???) </pre></div> <p>│╗║╬└√└╕╖╬ ┤┘└╜░· ░░└╠ └┌╡┐║»╚»╡╚┤┘</p> <div class="example"><pre> /internal/cgi/user/wwwidx?i=/u/user/foo/ </pre></div> <p>░░└║ ╣µ╣²└╕╖╬ ╕╡┼⌐ ╡┌┐í <code>:log</code>╕ª ╗τ┐δ╟╧┐⌐ ┴ó▒┘ ╖╬▒╫ 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 "<b>ERROR</b>: 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 "<b>ERROR</b>: 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, "<$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 < $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_USER_AGENT} ^<strong>NameOfBadRobot</strong>.* RewriteCond %{REMOTE_ADDR} ^<strong>123\.45\.67\.[8-9]</strong>$ RewriteRule ^<strong>/~quux/foo/arc/</strong>.+ - [<strong>F</strong>] </pre></div> </dd> </dl> <h3>▒╫╕▓ ╞█░í▒Γ ╣µ┴÷</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p><code>http://www.quux-corp.de/~quux/</code>┐í └╓┤┬ ╞Σ└╠┴÷╡Θ└╠ GIF ▒╫╕▓└╗ ╞≈╟╘╟╤┤┘░φ ░í┴ñ╟╧└┌. └╠ ▒╫╕▓└╠ ╕┌└╓╛ε╝¡, ┤┘╕Ñ ╗τ╢≈╡Θ└╠ └┌╜┼└╟ ╞Σ└╠┴÷┐í ┴≈┴ó ╕╡┼⌐╕ª ░╟┤┘. ╝¡╣÷┐í ║╥╟╩┐Σ╟╤ ║╬┤π└╠ ╡╟╣╟╖╬ ╕╖░φ ╜═┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>▒╫╕▓└╗ 100% ║╕╚ú╟╥ ╝÷┤┬ ╛°┴÷╕╕, ├╓╝╥╟╤ ║Ω╢≤┐∞└·░í HTTP Referer ╟∞┤⌡╕ª ║╕│╗┤┬ ░µ┐∞ ┴ª╟╤╟╥ ╝÷ └╓┤┘.</p> <div class="example"><pre> RewriteCond %{HTTP_REFERER} <strong>!^$</strong> RewriteCond %{HTTP_REFERER} !^http://www.quux-corp.de/~quux/.*$ [NC] RewriteRule <strong>.*\.gif$</strong> - [F] </pre></div> <div class="example"><pre> RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !.*/foo-with-gif\.html$ RewriteRule <strong>^inlined-in-foo\.gif$</strong> - [F] </pre></div> </dd> </dl> <h3>╚ú╜║╞« ░┼║╬</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>╛ε╢╗░╘ ┐▄║╬┐í╝¡ ╝¡╣÷┐í ┴ó▒┘╟╥ ╝÷ ╛°┤┬ ╚ú╜║╞« ╕±╖╧└╗ ╝│┴ñ╟╥ ╝÷ └╓│¬?</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╛╞╞──í >= 1.3b6┐í╝¡:</p> <div class="example"><pre> RewriteEngine on RewriteMap hosts-deny txt:/path/to/hosts.deny RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR] RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND RewriteRule ^/.* - [F] </pre></div> <p>╛╞╞──í <= 1.3b6┐í╝¡:</p> <div class="example"><pre> RewriteEngine on RewriteMap hosts-deny txt:/path/to/hosts.deny RewriteRule ^/(.*)$ ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}/$1 RewriteRule !^NOT-FOUND/.* - [F] RewriteRule ^NOT-FOUND/(.*)$ ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}/$1 RewriteRule !^NOT-FOUND/.* - [F] RewriteRule ^NOT-FOUND/(.*)$ /$1 </pre></div> <div class="example"><pre> ## ## hosts.deny ## ## ┴╓└╟! └╠░═└║ ╕±╖╧├│╖│ ║╕└╠┴÷╕╕ ╕±╖╧└╠ ╛╞┤╧╢≤ ╕╩└╠┤┘. ## mod_rewrite┤┬ └╠ ┴ñ║╕╕ª ┼░/░¬ ╜╓└╕╖╬ ╟╪╝«╟╧▒Γ╢º╣«┐í, ## ░ó ╟╫╕±└╟ ░¬ └┌╕«┐í ├╓╝╥╟╤ "-"░í ╟╩┐Σ╟╧┤┘. ## 193.102.180.41 - bsdti1.sdm.de - 192.76.162.40 - </pre></div> </dd> </dl> <h3>╟┴╖╧╜├ ░┼║╬</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>╛ε╢╗░╘ ╞»┴ñ ╚ú╜║╞« ╚ñ└║ ╞»┴ñ ╚ú╜║╞«└╟ ╗τ┐δ└┌░í ╛╞╞──í ╟┴╖╧╜├╕ª ╗τ┐δ╟╥ ╝÷ ╛°╡╡╖╧ ╟╧│¬?</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>╕╒└· ╛╞╞──í └Ñ╝¡╣÷╕ª ──╞─└╧╟╥╢º ▒╕╝║╞─└╧┐í╝¡ <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>░í <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> ╛╞╖í┐í(!) └╓╛ε╛▀ ╟╤┤┘. ▒╫╖»╕Θ <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>┤┬ <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> <em>└╠└ⁿ┐í</em> ║╥╕░┤┘. └╠┴ª ┤┘└╜░· ░░└╠ ╞»┴ñ ╚ú╜║╞«╕ª ░┼║╬╟╧╡╡╖╧ ╝│┴ñ╟╤┤┘...</p> <div class="example"><pre> RewriteCond %{REMOTE_HOST} <strong>^badhost\.mydomain\.com$</strong> RewriteRule !^http://[^/.]\.mydomain.com.* - [F] </pre></div> <p>...▒╫╕«░φ ┤┘└╜└║ user@host┐í ╡√╢≤ ░┼║╬╟╤┤┘:</p> <div class="example"><pre> RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <strong>^badguy@badhost\.mydomain\.com$</strong> RewriteRule !^http://[^/.]\.mydomain.com.* - [F] </pre></div> </dd> </dl> <h3>╞»║░╟╤ └╬┴⌡ ╣µ╜─</h3> <dl> <dt>╗≤╚░╝│╕φ:</dt> <dd> <p>░í▓√ ╕┼┐∞ ╞»║░╟╤ └╬┴⌡└╠ ╟╩┐Σ╟╥ ╢º░í └╓┤┘. ┐╣╕ª ╡Θ╛ε, ╣╠╕« ╝│┴ñ╟╪╡╨ ╗τ┐δ└┌└╬┴÷ ░╦╗τ╟╤┤┘. └╠╡Θ┐í░╘╕╕ (<code class="module"><a href="../mod/mod_auth.html">mod_auth</a></code>└╟ Basic Auth╕ª ╗τ┐δ╟╤ ░µ┐∞┐═ ┤▐╕«) ║░┤┘╕Ñ ╣░└╜╛°└╠ ┴ó▒┘└╗ ╟π┐δ╟╤┤┘.</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>─ú▒╕╕╕ ┴ó▒┘└╠ ░í┤╔╟╧╡╡╖╧ └τ└█╝║ ▒╘─ó╡Θ└╗ ╗τ┐δ╟╤┤┘:</p> <div class="example"><pre> RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <strong>!^friend1@client1.quux-corp\.com$</strong> RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <strong>!^friend2</strong>@client2.quux-corp\.com$ RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <strong>!^friend3</strong>@client3.quux-corp\.com$ RewriteRule ^/~quux/only-for-friends/ - [F] </pre></div> </dd> </dl> <h3>Referer▒Γ╣▌ ║»╚»▒Γ(deflector)</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>"Referer" HTTP ╟∞┤⌡┐í ╡√╢≤ ┐°╟╧┤┬┤δ╖╬ ┬ⁿ┴╢╞Σ└╠┴÷╕ª ╝│┴ñ╟╥ ╝÷ └╓┤┬ └»┐¼╟╤ URL ║»╚»▒Γ╕ª ╕╕╡Θ ╝÷ └╓┤┬░í?</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>┤┘└╜░· ░░└╠ ║╣└Γ╟╤ ▒╘─ó└╗...</p> <div class="example"><pre> RewriteMap deflector txt:/path/to/deflector.map RewriteCond %{HTTP_REFERER} !="" RewriteCond ${deflector:%{HTTP_REFERER}} ^-$ RewriteRule ^.* %{HTTP_REFERER} [R,L] RewriteCond %{HTTP_REFERER} !="" RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND RewriteRule ^.* ${deflector:%{HTTP_REFERER}} [R,L] </pre></div> <p>... └τ└█╝║ ╕╩░· ░░└╠ ╗τ┐δ╟╤┤┘:</p> <div class="example"><pre> ## ## deflector.map ## http://www.badguys.com/bad/index.html - http://www.badguys.com/bad/index2.html - http://www.badguys.com/bad/index3.html http://somewhere.com/ </pre></div> <p>▒╫╖»╕Θ ┐Σ├╗└╗ └┌╡┐└╕╖╬ (╕╩┐í╝¡ ░¬└╕╖╬ "<code>-</code>"╕ª ╗τ┐δ╟╤ ░µ┐∞) ┬ⁿ┴╢╞Σ└╠┴÷│¬ (URL└╠ ╕╩┐í └╓┤┬ ░µ┐∞ ╡╬╣°┬░ ╛╞▒╘╕╒╞«╖╬) ╞»┴ñ URL╖╬ ╕«┤┘└╠╖║╝╟╟╤┤┘.</p> </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="other" id="other">▒Γ┼╕</a></h2> <h3>┐▄║╬ └τ└█╝║ ┐ú┴°</h3> <dl> <dt>╗≤╚▓╝│╕φ:</dt> <dd> <p>FAQ: ╛ε╢╗░╘ └╠╖▒└·╖▒ └Γ┤┘╟╤ ╣«┴ª╕ª ╟« ╝÷ └╓┤┬░í? <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>╖╬┤┬ ╟╪░ß├Ñ└╠ ╛╚║╕└╬┤┘...</p> </dd> <dt>╟╪░ß├Ñ:</dt> <dd> <p>┐▄║╬ <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>└╗ ╗τ┐δ╟╧╢≤. ┴∩, ╟┴╖╬▒╫╖Ñ└╠ <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code> ┐¬╟╥└╗ ╟╤┤┘. ╟┴╖╬▒╫╖Ñ└║ ╛╞╞──í░í ╜├└█╟╥╢º ╜├└█╟╧┐⌐ <code>STDIN</code>┐í╝¡ ┐Σ├╗╟╤ URL└╗ ╣▐░φ, (░░└║ ╝°╝¡╖╬!) ░ß░· (║╕┼δ └τ└█╝║╡╚) URL└╗ <code>STDOUT</code>┐í ├Γ╖┬╟╤┤┘.</p> <div class="example"><pre> RewriteEngine on RewriteMap quux-map <strong>prg:</strong>/path/to/map.quux.pl RewriteRule ^/~quux/(.*)$ /~quux/<strong>${quux-map:$1}</strong> </pre></div> <div class="example"><pre> #!/path/to/perl # ╛╞╞──í ╝¡╣÷░í ╕╪├▀┴÷ ╛╩╡╡╖╧ # └╘├Γ╖┬ ╣÷╞█╕ª ╗τ┐δ╟╧┴÷ ╛╩┤┬┤┘ $| = 1; # stdin┐í╝¡ ╟╤┴┘╛┐ URL└╗ └╨░φ # stdout┐í ║»╚»╟╤ URL└╗ ├Γ╖┬╟╤┤┘ while (<>) { s|^foo/|bar/|; print $_; } </pre></div> <p>╝│╕φ╟╧▒Γ└º╟╪ ╕≡╡τ <code>/~quux/foo/...</code> URL└╗ <code>/~quux/bar/...</code>╖╬ └τ└█╝║╟╧┤┬ ╜║┼⌐╕│╞«╕ª ┐╣╖╬ ╡Θ╛·┤┘. ╜╟┴ª╖╬ ╕╢└╜┤δ╖╬ ╟┴╖╬▒╫╖í╣╓╟╥ ╝÷ └╓┤┘. ▒╫╖»│¬ └╧╣▌ ╗τ┐δ└┌░í └╠╖▒ ╕╩└╗ <strong>╗τ┐δ╟╥</strong> ╝÷ └╓┤┘░φ ╟╧┤⌡╢≤░φ, ┐└┴≈ ╜├╜║┼█ ░ⁿ╕«└┌╕╕└╠ ╕╩└╗ <strong>┴ñ└╟╟╪╛▀</strong> ╟╘└╗ ┴╓└╟╟╧╢≤.</p> </dd> </dl> </div></div> <div class="bottomlang"> <p><span>░í┤╔╟╤ ╛≡╛ε: </span><a href="../en/misc/rewriteguide.html" hreflang="en" rel="alternate" title="English"> en </a> | <a href="../ko/misc/rewriteguide.html" title="Korean"> ko </a></p> </div><div id="footer"> <p class="apache">Copyright 1999-2004 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> <p class="menu"><a href="../mod/">╕≡╡Γ</a> | <a href="../mod/directives.html">┴÷╜├╛ε╡Θ</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">┐δ╛ε</a> | <a href="../sitemap.html">╗τ└╠╞«╕╩</a></p></div> </body></html>