rewriteguide.xml.ko revision 1fc594205bd58583a2660536729eb684f5cb7932
904N/A<?xml version="1.0" encoding="EUC-KR" ?>
904N/A<!DOCTYPE manualpage SYSTEM "/style/manualpage.dtd">
904N/A<?xml-stylesheet type="text/xsl" href="/style/manual.ko.xsl"?>
904N/A<!-- English Revision: 122770:420990 (outdated) -->
904N/A
904N/A<!--
904N/A Licensed to the Apache Software Foundation (ASF) under one or more
904N/A contributor license agreements. See the NOTICE file distributed with
904N/A this work for additional information regarding copyright ownership.
904N/A The ASF licenses this file to You under the Apache License, Version 2.0
904N/A (the "License"); you may not use this file except in compliance with
904N/A the License. You may obtain a copy of the License at
904N/A
904N/A http://www.apache.org/licenses/LICENSE-2.0
904N/A
904N/A Unless required by applicable law or agreed to in writing, software
904N/A distributed under the License is distributed on an "AS IS" BASIS,
904N/A WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
904N/A See the License for the specific language governing permissions and
904N/A limitations under the License.
904N/A-->
904N/A
904N/A<manualpage metafile="rewriteguide.xml.meta">
904N/A <parentdocument href="./">Miscellaneous Documentation</parentdocument>
904N/A
904N/A <title>URL ���ۼ� ��ħ��</title>
904N/A
904N/A <summary>
904N/A <note>
904N/A <p>������<br />
904N/A <cite>Ralf S. Engelschall &lt;rse@apache.org&gt;</cite><br />
904N/A 1997�� 12��</p>
904N/A </note>
904N/A
904N/A <p>�� ������ <module>mod_rewrite</module> <a
904N/A href="/mod/mod_rewrite.html">���� ����</a>�� �����Ѵ�.
904N/A �� ������ �����ڰ� ���� �۾����� �ε�ġ�ԵǴ� ��������
904N/A URL��� ������ �ذ��ϱ����ؼ� ��� ����ġ
904N/A <module>mod_rewrite</module>�� ����ϴ��� �����Ѵ�. URL
904N/A ���ۼ� ��Ģ�� �����Ͽ� ������ �ذ��ϴ� ����� �ڼ��� �����Ѵ�.</p>
</summary>
<section id="ToC1">
<title><code>mod_rewrite</code> �Ұ�</title>
<p>����ġ <module>mod_rewrite</module> ����� �����ϴ�.
��, URL�� ������ �� �ִ� �����ϰ� �Ƿ� ������ ����̴�.
����ؿԴ� ���� ��� ������ URL ������ �����ϴ�. �׷���
�� �밡�� ����ϱ� �����ϴ�. <module>mod_rewrite</module>��
�ִ� ������ �ʺ��ڰ� �����ϰ� ����ϱ� ���� �ʴٴ� ���̴�.
������ ����ġ ��� ���� <module>mod_rewrite</module>��
���ο� �뵵�� �߰��Ѵ�.</p>
<p>�ٸ� ����: <module>mod_rewrite</module>�� ���� �����
ó���� ���� �԰� ���� �ٽ� ������� �ʰų�, �����Կ� �ŷ�Ǿ�
������ �� ���� ��� ���� ���̴�. �� ���� ù��° ��츦
�������� �̹� �˷��� ��� �����ʸ� �Ұ��Ϸ��� �Ѵ�.</p>
</section>
<section id="ToC2">
<title>�ǿ����� �ذ�å</title>
<p>���� ���� ���� �����ų� �ٸ� ������� ���� ���� �ǿ�����
�ذ�å�� ���´�. �������� URL ���ۼ��� �渶���� ������ ����
�ٶ���.</p>
<note type="warning">����: ���� ������ ��� ��Ȳ�� �°�
������ ���� �����ؾ� �� ��찡 �ִ�. ���� ���, �߰���
<module>mod_alias</module>, <module>mod_userdir</module>
���� ����Ѵٸ� <code>[PT]</code> �÷��׸� �߰��Ѵ�. Ȥ��
�ּ�������/����ȣ��Ʈ �����Ұ� �ƴ� <code>.htaccess</code>
�����ҿ� �˸°� ��Ģ�� ������ ���� �ִ�. ����ϱ� ��
�׻� ��Ģ�� � ����� �ϴ��� �����ϵ��� �ض�. �׷��� ������
���� �� �ִ�.</note>
</section>
<section id="url">
<title>URL ����</title>
<section>
<title>������ �Ǵ� URL</title>
<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>
<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></example>
</dd>
</dl>
</section>
<section>
<title>������ �Ǵ� ȣ��Ʈ��</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>...</dd>
<dt>�ذ�å:</dt>
<dd>
<example><pre>
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]
RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://fully.qualified.domain.name/$1 [L,R]
</pre></example>
</dd>
</dl>
</section>
<section>
<title><code>DocumentRoot</code>�� �ű� ���</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>�������� <directive
module="core">DocumentRoot</directive>�� ���� URL
"<code>/</code>"�� ���� ����ִ�. �׷��� �̰��� ���
�ڷᰡ ���� �ʰ�, �ڷᰡ �ٸ� ���� ���� ������ִ�
��찡 �ִ�. ���� ��� ��Ʈ��� ����Ʈ�� (�ܺθ� ����
Ȩ������) <code>/e/www/</code>�� (��Ʈ����� ����
Ȩ������) <code>/e/sww/</code>�� �ִٰ� ����. ����
<directive module="core">DocumentRoot</directive>��
<code>/e/www/</code>�̱⶧����, ��û���� ��������
���Ե� �׸� ���� �̰����� �����;� �Ѵ�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>�츮�� URL <code>/</code>�� <code>/e/www/</code>��
�����̷��Ǹ� �ϸ� �ȴ�. ����� �������� ������
<module>mod_rewrite</module>�� ����ؼ��� �����ϴ�.
(<module>mod_alias</module> ���� �����ϴ�) URL
<em>Alias</em> ���� �������� ����� <em>�պκ�</em>��
��. <directive module="core">DocumentRoot</directive>��
��� URL�� �պκ��̱⶧���� �� ����� ����Ͽ� �����̷�����
�� �� ���. <module>mod_rewrite</module>�� ����ϸ�
��¥ �����ϴ�:</p>
<example><pre>
RewriteEngine on
RewriteRule <strong>^/$</strong> /e/www/ [<strong>R</strong>]
</pre></example>
</dd>
</dl>
</section>
<section>
<title>������ ������ ����</title>
<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>
<example><pre>
RewriteEngine on
RewriteBase /~quux/
RewriteRule ^foo<strong>$</strong> foo<strong>/</strong> [<strong>R</strong>]
</pre></example>
<p>Ȩ���丮�� �ֻ��� <code>.htaccess</code> ���Ͽ�
������ ���� ������ ���� �ִ�. �׷��� ó���ϴµ� �δ���
�ȴ�.</p>
<example><pre>
RewriteEngine on
RewriteBase /~quux/
RewriteCond %{REQUEST_FILENAME} <strong>-d</strong>
RewriteRule ^(.+<strong>[^/]</strong>)$ $1<strong>/</strong> [R]
</pre></example>
</dd>
</dl>
</section>
<section>
<title>�ϰ�� URL ������ ���� ��Ŭ������</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>��Ʈ��� ���������� ��� �������� �����ϰ� �ϰ��
URL ������ ����� �ʹ�. ��, ��� (���ǻ� ������ ���Ͽ�
������ ��������!) URL�� ���� <em>����������</em> �����!
�� �̸��� ������������ ������ ������ �ο��ؾ� �Ѵ�:
URL�� ���� ������ ��Ī�ϸ� �ȵȴ�. �������� �ڵ�����
���� ������ �����Ѵ�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>���� �����, �׷�, ����ü�� ��ġ ������ ������
(�л��) �ܺθʿ� ���� ���� ������ ���´�. �ܺθ���
������ ���� ����̴�</p>
<example><pre>
user1 server_of_user1
user2 server_of_user2
: :
</pre></example>
<p>�츮�� �� ������ ���� <code>map.xxx-to-host</code>
���Ͽ� �����ߴ�. �������� ��� �������� URL�� ������
��ٸ� ������ ���� URL��,</p>
<example><pre>
/u/user/anypath
/g/group/anypath
/e/entity/anypath
</pre></example>
<p>������ ���� �����̷����Ѵ�</p>
<example><pre>
http://physical-host/u/user/anypath
http://physical-host/g/group/anypath
http://physical-host/e/entity/anypath
</pre></example>
<p>�Ʒ� ��Ģ�� �������� ����Ͽ� �� �۾��� �Ѵ� (server0��
�ʿ� �׸��� ��� ��� ����� �⺻������� �����Ѵ�):</p>
<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></example>
</dd>
</dl>
</section>
<section>
<title>Ȩ���丮�� �ٸ� �������� ����</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>���� �����ڴ� �������� ��� Ȩ���丮�� �ٸ�
�������� ������ ��� �ذ�å�� �����. �� �����
���� ������ ��ü�� ���ο� ������ �����ϴµ� �ð���
�ɸ��� ��쿡 �ʿ��ϴ�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p><module>mod_rewrite</module>�� ����ϸ� �����ϴ�.
���� �������� ��� <code>/~user/anypath</code> URL��
<code>http://newserver/~user/anypath</code>��
�����̷����ϸ� �ȴ�.</p>
<example><pre>
RewriteEngine on
RewriteRule ^/~(.+) http://<strong>newserver</strong>/~$1 [R,L]
</pre></example>
</dd>
</dl>
</section>
<section>
<title>Ȩ���丮 ���� �����</title>
<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>
<example><pre>
RewriteEngine on
RewriteRule ^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*) /home/<strong>$2</strong>/$1/.www$3
</pre></example>
</dd>
</dl>
</section>
<section>
<title>���Ͻý��� �籸��</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>�� ���� �Ƿ� �ϵ��ھ����̴�: ���丮��
<code>RewriteRules</code>�� �ſ� ���� ����Ͽ� �ڷ�
��ü�� �״�� ��ü�� ���� �ڷḦ �ڿ������� ����¡�ϵ���
�Ѵ�. ���: ���� 1992�� ���� �����Ӱ� ����� �� �ִ�
���н� ����Ʈ������� <strong><em>net.sw</em></strong>��
��Ƶΰ� �־��. �̴� ���� ��ǻ�Ͱ����� ����ϸ鼭
�����ص��� �����ð��� �ý��� ���ڿ� ��Ʈ�� ���ڸ�
�ؿԱ⶧���� �� ������� ���̴�. ���ָ��� ���� ����Ʈ���
�߰��� ������ ���丮�� ��� �����Դ�:</p>
<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></example>
<p>1996�� 7�� �� ����Ҹ� ���ִ� �� �������̽��� ����
���� ���ϱ�� �����޴�. "���ִ�"�� ����, �ֻ���
���丮�� CGI ��ũ��Ʈ�� ���� �ʰ?, ����� ����������
���� �������ϱ� �ٶ��ٴ� ���̴�. ��? ����Ҹ� ���߿�
FTP�ε� ������ �� �ֵ��� ���� �����̿��⶧���� ���̳�
CGI�� ��õ� ������ ���� �α� �Ⱦ��.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>�ذ�å�� �� �κ����� ������: ���� ���丮 ���ؿ���
�ʿ��� ��� �������� �������� ����� CGI ��ũ��Ʈ��
�ʿ��ϴ�. ���� �� ��ũ��Ʈ���� ������ ����
<code>/e/netsw/.www/</code>�� ��:</p>
<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></example>
<p><code>DATA/</code> �������丮�� ������ ���� ����Ұ�
�ִ�. ���� <strong><em>net.sw</em></strong>�� ������ ����
<code>rdist</code>�� ����Ͽ� �ڵ����� �����´�. �ι�°
�κ��� ���Ҵ�: ��� �� �� ������ �ϳ��� �ڿ�������
URL ������ �����ϴ°�? ����ڿ��� <code>DATA/</code>
���丮�� ���߰�, URL���� ������ CGI ��ũ��Ʈ�� �����ϰ�
�ʹ�. �ذ�å�� ������ ����: ���� ������ <directive
module="core">DocumentRoot</directive>���� ���
URL <code>/net.sw/</code>�� ���� ��� <code>/e/netsw</code>��
���ۼ��ϱ����� ���丮�� �������Ͽ� ������ ���� �����Ѵ�:</p>
<example><pre>
RewriteRule ^net.sw$ net.sw/ [R]
RewriteRule ^net.sw/(.*)$ e/netsw/$1
</pre></example>
<p>ù��° ��Ģ�� �������� �������� ��� ��û�� ���ؼ�
����ߴ�! �ι�° ��Ģ�� ���� �۾��� �Ѵ�. �׸��� ���丮��
�������� <code>/e/netsw/.www/.wwwacl</code>�� ��������
������ ���´�:</p>
<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></example>
<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>
</section>
<section>
<title>NCSA imagemap�� ����ġ <code>mod_imagemap</code>����</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>������� NCSA ���������� �������� ����ġ ��������
�ڿ������� �Űܰ��� �ٶ���. �׷��� ������ NCSA
<code>imagemap</code> ���α׷��� ����� �������� ��������
����ġ <module>mod_imagemap</module>�� ó���ϱ� �ٶ���.
������ <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>
<example><pre>
RewriteEngine on
RewriteRule ^/cgi-bin/imagemap(.*) $1 [PT]
</pre></example>
</dd>
</dl>
</section>
<section>
<title>���� ���丮���� ������ �˻�</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>���� �������� ���� ���丮���� ������ ã�ƾ� ��
���� �ִ�. �� ��� MultiViews�� �ٸ� ����� ������
�ȵȴ�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>���� ���丮���� ������ ã�� ��Ģ�� ���� ���α׷��Ѵ�.</p>
<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></example>
</dd>
</dl>
</section>
<section>
<title>URL�� ��� ȯ�溯���� �����Ѵ�</title>
<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>
<example><pre>
RewriteEngine on
RewriteRule ^(.*)/<strong>S=([^/]+)</strong>/(.*) $1/$3 [E=<strong>STATUS:$2</strong>]
</pre></example>
</dd>
</dl>
</section>
<section>
<title>���� ����� ȣ��Ʈ</title>
<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>
<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></example>
</dd>
</dl>
</section>
<section>
<title>Ȩ���丮�� �ܺ� ������ �����̷���</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>���� ������ <code>ourdomain.com</code> �ۿ��� ��û��
������ Ȩ���丮 URL�� �ٸ� ������
<code>www.somewhere.com</code>���� ���ٸ������ϱ�
�ٶ���. ���� ����ȣ��Ʈ �����ҿ��� ����Ѵ�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>���ۼ� ������ ����ϸ� �ȴ�:</p>
<example><pre>
RewriteEngine on
RewriteCond %{REMOTE_HOST} <strong>!^.+\.ourdomain\.com$</strong>
RewriteRule ^(/~.+) http://www.somewhere.com/$1 [R,L]
</pre></example>
</dd>
</dl>
</section>
<section>
<title>������ URL�� �ٸ� �������� �����̷���</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>URL ���ۼ��� ���ؼ� ������ A�� �ش� ������ ���
��� ������ B�� ��û�� �����̷����ϴ� ����� ����
�����. ���� Perl�� �ۼ��� <directive
module="core">ErrorDocument</directive> CGI ��ũ��Ʈ��
���������, <module>mod_rewrite</module>�� ����ϴ�
��� �ִ�. �׷��� ������ <directive
module="core">ErrorDocument</directive> CGI ��ũ��Ʈ����
�������� ����϶�!</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>ù��° ����� ������ �������� �������� ��������
�ʴ�:</p>
<example><pre>
RewriteEngine on
RewriteCond /your/docroot/%{REQUEST_FILENAME} <strong>!-f</strong>
RewriteRule ^(.+) http://<strong>webserverB</strong>.dom/$1
</pre></example>
<p>�� ����� ������ <directive
module="core">DocumentRoot</directive> �ȿ� �ִ� ��������
�����ϴٴ� ���̴�. (���� ��� Ȩ���丮 ���� ����)
������ �߰��� �� ������, �� ���� ����� �ִ�:</p>
<example><pre>
RewriteEngine on
RewriteCond %{REQUEST_URI} <strong>!-U</strong>
RewriteRule ^(.+) http://<strong>webserverB</strong>.dom/$1
</pre></example>
<p><module>mod_rewrite</module>�� URL �������(look-ahead)��
����Ѵ�. �׷��� ��� URL�� �����ϰ� �����ϴ�. �׷���
��� ��û���� ���� ������û�� �ѹ� �� �ϱ⶧���� ������
���ɿ� �ǿ����� �ش�. �׷��� ������ CPU���� ��������
�����Ѵٸ� ����϶�. ��ǻ�Ͱ� �����ٸ� ù��° ����̳�
�� ���� <directive module="core">ErrorDocument</directive>
CGI ��ũ��Ʈ�� ����϶�.</p>
</dd>
</dl>
</section>
<section>
<title>Ȯ�� �����̷���</title>
<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>
<example><pre>
RewriteRule ^xredirect:(.+) /path/to/nph-xredirect.cgi/$1 \
[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 "&lt;html&gt;\n";
print "&lt;head&gt;\n";
print "&lt;title&gt;302 Moved Temporarily (EXTENDED)&lt;/title&gt;\n";
print "&lt;/head&gt;\n";
print "&lt;body&gt;\n";
print "&lt;h1&gt;Moved Temporarily (EXTENDED)&lt;/h1&gt;\n";
print "The document has moved &lt;a HREF=\"$url\"&gt;here&lt;/a&gt;.&lt;p&gt;\n";
print "&lt;/body&gt;\n";
print "&lt;/html&gt;\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 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></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>&lt;STRING</code>, <code>&gt;STRING</code>,
<code>=STRING</code>�� ����Ͽ� �ð��� ��� �����̷�����
�� �ִ�:</p>
<example><pre>
RewriteEngine on
RewriteCond %{TIME_HOUR}%{TIME_MIN} &gt;0700
RewriteCond %{TIME_HOUR}%{TIME_MIN} &lt;1900
RewriteRule ^foo\.html$ foo.day.html
RewriteRule ^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 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></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 on
RewriteBase /~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 on
RewriteBase /~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 on
RewriteBase /~quux/
RewriteRule ^<strong>hotsheet/</strong>(.*)$ <strong>http://www.tstimpreso.com/hotsheet/</strong>$1 [<strong>P</strong>]
</pre></example>
<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></example>
</dd>
</dl>
</section>
<section>
<title>���� ���̷�</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>...</dd>
<dt>�ذ�å:</dt>
<dd>
<example><pre>
RewriteEngine on
RewriteCond /mirror/of/remotesite/$1 -U
RewriteRule ^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>
<p>���� ��ȭ���� ���� �������� ��ȣ�ϰ� �ܺ� ����������
���� ���������� �ڷḦ ���� �� �ְ� �Ѵ�. ������ ����
��Ŷ���͸� ��ȭ���� �����Ѵ�:</p>
<example><pre>
<strong>ALLOW</strong> Host www.quux-corp.dom Port &gt;1024 --&gt; Host www2.quux-corp.dom Port <strong>80</strong>
<strong>DENY</strong> Host * Port * --&gt; Host www2.quux-corp.dom Port <strong>80</strong>
</pre></example>
<p>���� �������� �˸°� ���Ķ�. ��� �ڷḦ ����������
proxy throughput ����� ���� ��û�ϴ�
<module>mod_rewrite</module> ��Ģ�� �ۼ��Ѵ�:</p>
<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></example>
</dd>
</dl>
</section>
<section>
<title>�ε�뷱�� (���� �л��ϱ�)</title>
<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�� ����� �� �˷��� ����� �����ϰ�,
<module>mod_rewrite</module>�� ����ϴ� ��츦 ���캸��:</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>
<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></example>
<p>�׸��� ���� �׸��� �߰��Ѵ�:</p>
<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></example>
<p>�߸�� ��ó�� ��������, ������ <code>BIND</code>��
�ǵ��� ����̴�. ���� <code>www.foo.com</code>��
ã����, <code>BIND</code>�� �Ź� �� ���ݾ�
�ٲ㰡�� <code>www0-www6</code>�� ��ȯ�Ѵ�. �׷���
Ŭ���̾�Ʈ���� ���� ������ �л��Ѵ�. �׷��� DNS
�˻� ��� ��Ʈ���� �ٸ� ���Ӽ����� ij���ǿ�
<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>�� ����� <module>mod_rewrite</module>�� proxy
throughput ����� ����Ѵ�. ���� DNS�� ���� �׸���
����Ͽ� <code>www0.foo.com</code>�� ����
<code>www.foo.com</code>�� ����ϰ� �Ѵ�</p>
<example><pre>
www IN CNAME www0.foo.com.
</pre></example>
<p>�׸��� <code>www0.foo.com</code>�� ���Ͻ����
������ �����Ѵ�. ��, URL�� ������ ������ ����
���Ͻø� ���� �ٸ� 5�� ������ (<code>www1-www5</code>)
�Ѵ�� �����⸸ �Ѵ�. �̸� ���� ���� ��� URL��
�ε�뷱�� ��ũ��Ʈ <code>lb.pl</code>�� ������
��Ģ�� �����.</p>
<example><pre>
RewriteEngine on
RewriteMap lb prg:/path/to/lb.pl
RewriteRule ^/(.+)$ ${lb:$1} [P,L]
</pre></example>
<p><code>lb.pl</code>�� �ۼ��Ѵ�:</p>
<example><pre>
#!/path/to/perl
##
## lb.pl -- �ε�뷱�� ��ũ��Ʈ
##
$| = 1;
$name = "www"; # �⺻ ȣ��Ʈ��
$first = 1; # ù��° ���� (�ڽ��� 0�̱� ������, 0�� ������� �ʴ´�)
$last = 5; # round-robin���� ������ ����
$domain = "foo.dom"; # �����θ�
$cnt = 0;
while (&lt;STDIN&gt;) {
$cnt = (($cnt+1) % ($last+1-$first));
$server = sprintf("%s%d.%s", $name, $cnt+$first, $domain);
print "http://$server/$_";
}
##EOF##
</pre></example>
<note>������ ����: �� �� ����� �����Ѱ�?
<code>www0.foo.com</code>�� �δ��� �����ʴ°�?
����, �δ��� �ȴ�. �׷��� �ܼ��� proxy throughput
��û�� �ϱ⶧���� �����! ��� SSI, CGI, ePerl
���� �������� �ٸ� ������ ó���Ѵ�. �̰��� �ٽ��̴�.</note>
</li>
<li>
<strong>�ϵ����/TCP Round-Robin</strong>
<p>�ϵ��� ����� �ذ�å�� �ִ�. Cisco�� TCP/IP
���ؿ��� �ε�뷱���� �ϴ� LocalDirector��� ������
�Ǵ�. �����δ� �������� �մܿ� ��ġ�ϴ� ������
ȸ�μ��� ����Ʈ���̴�. �ڱ��� ����ϰ� �?��
�ذ�å�� �ʿ��ϴٸ� �̰��� ����϶�.</p>
</li>
</ol>
</dd>
</dl>
</section>
<section>
<title>���ο� MIME-type, ���ο� ����</title>
<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>
<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></example>
<p>���� �ٸ� ���� ���α׷�, (URL ����Ʈ���� ����
<code>access.log</code>�� ����ϴ�) <code>wwwlog</code>��
(URL ����Ʈ���� Glimpse�� �����ϴ�) <code>wwwidx</code>��
�ִٰ� ��������. �츮�� ���α׷����� �۾��� �����
URL ������ �˷���� �Ѵ�. �׷��� ��û�Ҷ����� �׻�
������ �ϱ⶧���� ������� �ʴ�. ��, ����
<code>/u/user/foo/</code>�� ���� <code>swwidx</code>
���α׷��� �����Ѵٸ� ������ ���� ��ũ�� ����Ѵ�</p>
<example><pre>
/internal/cgi/user/swwidx?i=/u/user/foo/
</pre></example>
<p>������� �ʴ�. ��ũ�� ������ ��ġ<strong>��</strong>
CGI ��ġ�� <strong>���</strong> ���� �ϱ⶧���̴�.
������ �籸���Ѵٸ� ���� �����۸�ũ�� �����ϴµ� ����
�ð��� �ɸ� ���̴�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>�ذ�å�� �ڵ����� ������ CGI�� �����ϴ� ���ο�
Ư���� URL ����� ����� ���̴�. ������ ���� �����Ѵ�:</p>
<example><pre>
RewriteRule ^/([uge])/([^/]+)(/?.*)/\* /internal/cgi/user/wwwidx?i=/$1/$2$3/
RewriteRule ^/([uge])/([^/]+)(/?.*):log /internal/cgi/user/wwwlog?f=/$1/$2$3
</pre></example>
<p>���� <code>/u/user/foo/</code>�� �˻��ϴ� ��ũ��
������ ����</p>
<example><pre>
HREF="*"
/u/user/foo/* (???)
</pre></example>
<p>���������� ������ ���� �ڵ���ȯ�ȴ�</p>
<example><pre>
/internal/cgi/user/wwwidx?i=/u/user/foo/
</pre></example>
<p>���� ������� ��ũ �ڿ� <code>:log</code>�� ����Ͽ�
���� �α� CGI ���α׷��� ������ �� �ִ�.</p>
</dd>
</dl>
</section>
<section>
<title>���� ��������</title>
<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>
<example><pre>
RewriteEngine on
RewriteBase /~quux/
RewriteRule ^foo\.<strong>html</strong>$ foo.<strong>cgi</strong> [T=<strong>application/x-httpd-cgi</strong>]
</pre></example>
</dd>
</dl>
</section>
<section>
<title>�N ������ ���</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>�� ����� �Ƿ� ����̴�: �������� �������� ��������,
�������� �������� �����Ѵ�. ��, �������� ����ϰ�
(���Ͻý��ۿ��� ���� ������ �״��) ���� ��������
��޵�����, ���� ��� �������� �������� ���Ѵ�.
�׷��� ���� (Ȥ�� cron �۾���) ���� �������� �������ʴ�
�� CGI�� ���� �������� �������� �����Ѵ�. ��������
����� ������ �����Ѵ�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
���� ��Ģ�� ����Ѵ�:
<example><pre>
RewriteCond %{REQUEST_FILENAME} <strong>!-s</strong>
RewriteRule ^page\.<strong>html</strong>$ page.<strong>cgi</strong> [T=application/x-httpd-cgi,L]
</pre></example>
<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>
</section>
<section>
<title>�ڵ����� ���� ��ħ�ϴ� ����</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>������ ���������� ���鶧 �����ڰ� ������ ������
������ �ڵ����� �������� ���� ��ħ�ϴ� ��������
������ �󸶳� ������? �Ұ����Ѱ�?</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>�����ϴ�! MIME multipart ��ɰ� ������ NPH ���,
<module>mod_rewrite</module>�� URL ���� �ɷ��� �����ϸ�
�ȴ�. ����, ���ο� URL ����� �����: URL��
<code>:refresh</code>�� �߰��ϱ⸸ �ϸ� ���Ͻý��ۿ���
������ ������ ���� ��ħ�Ѵ�.</p>
<example><pre>
RewriteRule ^(/[uge]/[^/]+/?.*):refresh /internal/cgi/apache/nph-refresh?f=$1
</pre></example>
<p>���� ���� URL�� �����ϸ�</p>
<example><pre>
/u/foo/bar/page.html:refresh
</pre></example>
<p>���� URL�� ���������� ���</p>
<example><pre>
/internal/cgi/apache/nph-refresh?f=/u/foo/bar/page.html
</pre></example>
<p>���� NPH-CGI ��ũ��Ʈ�� ���Ҵ�. ���� "���ڿ���
�������� ���ܵ�"�̶�� �������� ;-) ���� �̰͵� �����Ѵ�.</p>
<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(/&amp;/, $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 "&amp;lt;b&amp;gt;ERROR&amp;lt;/b&amp;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 "&amp;lt;b&amp;gt;ERROR&amp;lt;/b&amp;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";
&amp;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, "&amp;lt;$file");
$bytes = sysread(FP, $buffer, $size);
close(FP);
return $buffer;
}
$buffer = &amp;readfile($QS_f);
&amp;print_http_headers_multipart_begin;
&amp;displayhtml($buffer);
sub mystat {
local($file) = $_[0];
local($time);
($x, $x, $x, $x, $x, $x, $x, $x, $x, $mtime) = stat($file);
return $mtime;
}
$mtimeL = &amp;mystat($QS_f);
$mtime = $mtime;
for ($n = 0; $n &amp;lt; $QS_n; $n++) {
while (1) {
$mtime = &amp;mystat($QS_f);
if ($mtime ne $mtimeL) {
$mtimeL = $mtime;
sleep(2);
$buffer = &amp;readfile($QS_f);
&amp;print_http_headers_multipart_next;
&amp;displayhtml($buffer);
sleep(5);
$mtimeL = &amp;mystat($QS_f);
last;
}
sleep($QS_s);
}
}
&amp;print_http_headers_multipart_end;
exit(0);
##EOF##
</pre></example>
</dd>
</dl>
</section>
<section>
<title>�뷮�� ����ȣ��Ʈ</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>����ȣ��Ʈ�� ��� �ִٸ� ����ġ�� <directive
type="section" module="core">VirtualHost</directive>
����� �� �����Ѵ�. �׷��� ����ȣ��Ʈ�� ���鰳 �ִ�
ISP��� �� ����� �ּ��� �ƴϴ�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>�� ����� �����Ϸ��� <dfn>Proxy Throughput</dfn>
����� (�÷��� <code>[P]</code>) ����Ͽ� �ܺ� ��������
Ȥ�� ��ü �ܺ� �������� �츮�� �̸��� �����Ѵ�:</p>
<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></example>
<example><pre>
##
## httpd.conf
##
:
# �����̷�Ʈ�Ҷ� ���� ȣ��Ʈ���� ����Ѵ�.
UseCanonicalName on
:
# ����ȣ��Ʈ�� CLF ��� �տ� �߰��Ѵ�
CustomLog /path/to/access_log "%{VHOST}e %h %l %u %t \"%r\" %&gt;s %b"
:
# �ּ������� ���ۼ� ������ ����Ѵ�
RewriteEngine on
# �� ���� �����Ѵ�: �ϳ��� URL�� ��ġ��,
# �ٸ� �ϳ��� ����ȣ��Ʈ�� DocumentRoot��
# �����Ѵ�.
RewriteMap lowercase int:tolower
RewriteMap vhost txt:/path/to/vhost.map
# ���� ũ�� ������ ��Ģ �Ѱ��� ����Ͽ�
# ����ȣ��Ʈ�� �����Ѵ�.
#
# 1. ����ȣ��Ʈ���� ���� ����ϴ� ��ġ�� �������� �ʴ´�
RewriteCond %{REQUEST_URL} !^/commonurl1/.*
RewriteCond %{REQUEST_URL} !^/commonurl2/.*
:
RewriteCond %{REQUEST_URL} !^/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></example>
</dd>
</dl>
</section>
</section>
<section id="access">
<title>���� ����</title>
<section>
<title>�κ� ����</title>
<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>
<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></example>
</dd>
</dl>
</section>
<section>
<title>�׸� �۰��� ����</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p><code>http://www.quux-corp.de/~quux/</code>�� �ִ�
���������� GIF �׸��� �����Ѵٰ� ��������. �� �׸���
���־, �ٸ� ������� �ڽ��� �������� ���� ��ũ��
�Ǵ�. ������ ���ʿ��� �δ��� �ǹǷ� ���� �ʹ�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>�׸��� 100% ��ȣ�� ���� ������, �ּ��� ������
HTTP Referer ����� ������ ��� ������ �� �ִ�.</p>
<example><pre>
RewriteCond %{HTTP_REFERER} <strong>!^$</strong>
RewriteCond %{HTTP_REFERER} !^http://www.quux-corp.de/~quux/.*$ [NC]
RewriteRule <strong>.*\.gif$</strong> - [F]
</pre></example>
<example><pre>
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !.*/foo-with-gif\.html$
RewriteRule <strong>^inlined-in-foo\.gif$</strong> - [F]
</pre></example>
</dd>
</dl>
</section>
<section>
<title>ȣ��Ʈ �ź�</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>��� �ܺο��� ������ ������ �� ��� ȣ��Ʈ �����
������ �� �ֳ�?</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>����ġ &gt;= 1.3b6����:</p>
<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></example>
<p>����ġ &lt;= 1.3b6����:</p>
<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></example>
<example><pre>
##
## hosts.deny
##
## ����! �̰��� ���ó�� �������� ����� �ƴ϶� ���̴�.
## mod_rewrite�� �� ������ Ű/�� ������ �ؼ��ϱ⶧����,
## �� �׸��� �� �ڸ��� �ּ��� "-"�� �ʿ��ϴ�.
##
193.102.180.41 -
bsdti1.sdm.de -
192.76.162.40 -
</pre></example>
</dd>
</dl>
</section>
<section>
<title>���Ͻ� �ź�</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>��� Ư�� ȣ��Ʈ Ȥ�� Ư�� ȣ��Ʈ�� ����ڰ�
����ġ ���Ͻø� ����� �� ��� �ϳ�?</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>���� ����ġ �������� �������Ҷ� �������Ͽ���
<module>mod_rewrite</module>�� <module>mod_proxy</module>
�Ʒ���(!) �־�� �Ѵ�. �׷��� <module>mod_rewrite</module>��
<module>mod_proxy</module> <em>����</em> �Ҹ���.
���� ������ ���� Ư�� ȣ��Ʈ�� �ź��ϵ��� �����Ѵ�...</p>
<example><pre>
RewriteCond %{REMOTE_HOST} <strong>^badhost\.mydomain\.com$</strong>
RewriteRule !^http://[^/.]\.mydomain.com.* - [F]
</pre></example>
<p>...�׸��� ������ user@host�� ��� �ź��Ѵ�:</p>
<example><pre>
RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <strong>^badguy@badhost\.mydomain\.com$</strong>
RewriteRule !^http://[^/.]\.mydomain.com.* - [F]
</pre></example>
</dd>
</dl>
</section>
<section>
<title>Ư���� ���� ���</title>
<dl>
<dt>��Ȱ����:</dt>
<dd>
<p>���� �ſ� Ư���� ������ �ʿ��� ���� �ִ�. ����
���, �̸� �����ص� ��������� �˻��Ѵ�. �̵鿡�Ը�
(<module>mod_auth_basic</module>�� Basic Auth�� �����
���� �޸�) ���ٸ� �������� ������ ����Ѵ�.</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>ģ���� ������ �����ϵ��� ���ۼ� ��Ģ���� ����Ѵ�:</p>
<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></example>
</dd>
</dl>
</section>
<section>
<title>Referer��� ��ȯ��(deflector)</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>"Referer" HTTP ����� ��� ���ϴ´�� ������������
������ �� �ִ� ������ URL ��ȯ�⸦ ���� �� �ִ°�?</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>������ ���� ������ ��Ģ��...</p>
<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></example>
<p>... ���ۼ� �ʰ� ���� ����Ѵ�:</p>
<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></example>
<p>�׷��� ��û�� �ڵ����� (�ʿ��� ������ "<code>-</code>"��
����� ���) ������������ (URL�� �ʿ� �ִ� ��� �ι�°
�ƱԸ�Ʈ��) Ư�� URL�� �����̷����Ѵ�.</p>
</dd>
</dl>
</section>
</section>
<section id="other">
<title>��Ÿ</title>
<section>
<title>�ܺ� ���ۼ� ����</title>
<dl>
<dt>��Ȳ����:</dt>
<dd>
<p>FAQ: ��� �̷��� ����� ������ Ǯ �� �ִ°�?
<module>mod_rewrite</module>�δ� �ذ�å�� �Ⱥ��δ�...</p>
</dd>
<dt>�ذ�å:</dt>
<dd>
<p>�ܺ� <directive
module="mod_rewrite">RewriteMap</directive>�� ����϶�.
��, ���α׷��� <directive
module="mod_rewrite">RewriteMap</directive> ������
�Ѵ�. ���α׷��� ����ġ�� �����Ҷ� �����Ͽ�
<code>STDIN</code>���� ��û�� URL�� �ް�, (���� ���!)
��� (���� ���ۼ���) URL�� <code>STDOUT</code>�� ����Ѵ�.</p>
<example><pre>
RewriteEngine on
RewriteMap quux-map <strong>prg:</strong>/path/to/map.quux.pl
RewriteRule ^/~quux/(.*)$ /~quux/<strong>${quux-map:$1}</strong>
</pre></example>
<example><pre>
#!/path/to/perl
# ����ġ ������ ������ �ʵ���
# ����� ���۸� ������� �ʴ´�
$| = 1;
# stdin���� ���پ� URL�� �а�
# stdout�� ��ȯ�� URL�� ����Ѵ�
while (&lt;&gt;) {
s|^foo/|bar/|;
print $_;
}
</pre></example>
<p>�����ϱ����� ��� <code>/~quux/foo/...</code> URL��
<code>/~quux/bar/...</code>�� ���ۼ��ϴ� ��ũ��Ʈ��
���� ����. ������ ������� ���α׷����� �� �ִ�.
�׷��� �Ϲ� ����ڰ� �̷� ���� <strong>�����</strong>
�� �ִٰ� �ϴ����, ���� �ý��� ���ڸ��� ����
<strong>�����ؾ�</strong> ���� �����϶�.</p>
</dd>
</dl>
</section>
</section>
</manualpage>