1<?xml version="1.0" encoding="EUC-KR"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko"><head><!--
4        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5              This file is generated from xml source: DO NOT EDIT
6        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7      -->
8<title>URL ���ۼ� ��ħ�� - Apache HTTP Server</title>
9<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
12<script src="/style/scripts/prettify.js" type="text/javascript">
13</script>
14
15<link href="/images/favicon.ico" rel="shortcut icon" /></head>
16<body id="manual-page"><div id="page-header">
17<p class="menu"><a href="/mod/">���</a> | <a href="/mod/directives.html">���þ��</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">���</a> | <a href="/sitemap.html">����Ʈ��</a></p>
18<p class="apache">Apache HTTP Server Version 2.2</p>
19<img alt="" src="/images/feather.gif" /></div>
20<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
21<div id="path">
22<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.2</a> &gt; <a href="./">Miscellaneous Documentation</a></div><div id="page-content"><div id="preamble"><h1>URL ���ۼ� ��ħ��</h1>
23<div class="toplang">
24<p><span>������ ���: </span><a href="/en/misc/rewriteguide.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
25<a href="/ko/misc/rewriteguide.html" title="Korean">&nbsp;ko&nbsp;</a></p>
26</div>
27<div class="outofdate">�� ������ �ֽ��� ���� �ƴմϴ�.
28            �ֱٿ� ����� ������ ���� ������ ����ϼ���.</div>
29
30    <div class="note">
31      <p>������<br />
32      <cite>Ralf S. Engelschall &lt;rse@apache.org&gt;</cite><br />
33      1997�� 12��</p>
34    </div>
35
36    <p>�� ������ <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> <a href="/mod/mod_rewrite.html">���� ����</a>�� �����Ѵ�.
37    �� ������ �����ڰ� ���� �۾����� �ε�ġ�ԵǴ� ��������
38    URL��� ������ �ذ��ϱ����ؼ� ��� ����ġ
39    <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� ����ϴ��� �����Ѵ�. URL
40    ���ۼ� ��Ģ�� �����Ͽ� ������ �ذ��ϴ� ����� �ڼ��� �����Ѵ�.</p>
41
42  </div>
43<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#ToC1"><code>mod_rewrite</code> �Ұ�</a></li>
44<li><img alt="" src="/images/down.gif" /> <a href="#ToC2">�ǿ����� �ذ�å</a></li>
45<li><img alt="" src="/images/down.gif" /> <a href="#url">URL ����</a></li>
46<li><img alt="" src="/images/down.gif" /> <a href="#content">������ �ٷ��</a></li>
47<li><img alt="" src="/images/down.gif" /> <a href="#access">���� ����</a></li>
48<li><img alt="" src="/images/down.gif" /> <a href="#other">��Ÿ</a></li>
49</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
50<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
51<div class="section">
52<h2><a name="ToC1" id="ToC1"><code>mod_rewrite</code> �Ұ�</a></h2>
53
54    
55
56    <p>����ġ <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> ����� �����ϴ�.
57    ��, URL�� ������ �� �ִ� �����ϰ� �Ƿ� ������ ����̴�.
58    ����ؿԴ� ���� ��� ������ URL ������ �����ϴ�. �׷���
59    �� �밡�� ����ϱ� �����ϴ�. <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>��
60    �ִ� ������ �ʺ��ڰ� �����ϰ� ����ϱ� ���� �ʴٴ� ���̴�.
61    ������ ����ġ ��� ���� <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>��
62    ���ο� �뵵�� �߰��Ѵ�.</p>
63
64    <p>�ٸ� ����: <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� ���� �����
65    ó���� ���� �԰� ���� �ٽ� ������� �ʰų�, �����Կ� �ŷ�Ǿ�
66    ������ �� ���� ��� ���� ���̴�. �� ���� ù��° ��츦
67    �������� �̹� �˷��� ��� �����ʸ� �Ұ��Ϸ��� �Ѵ�.</p>
68
69  </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
70<div class="section">
71<h2><a name="ToC2" id="ToC2">�ǿ����� �ذ�å</a></h2>
72
73    
74
75    <p>���� ���� ���� �����ų� �ٸ� ������� ���� ���� �ǿ�����
76    �ذ�å�� ���´�. �������� URL ���ۼ��� �渶���� ������ ����
77    �ٶ���.</p>
78
79    <div class="warning">����: ���� ������ ��� ��Ȳ�� �°�
80    ������ ���� �����ؾ� �� ��찡 �ִ�. ���� ���, �߰���
81    <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>
82    ���� ����Ѵٸ� <code>[PT]</code> �÷��׸� �߰��Ѵ�. Ȥ��
83    �ּ�������/����ȣ��Ʈ �����Ұ� �ƴ� <code>.htaccess</code>
84    �����ҿ� �˸°� ��Ģ�� ������ ���� �ִ�. ����ϱ� ��
85    �׻� ��Ģ�� � ����� �ϴ��� �����ϵ��� �ض�. �׷��� ������
86    ���� �� �ִ�.</div>
87
88  </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
89<div class="section">
90<h2><a name="url" id="url">URL ����</a></h2>
91
92    
93
94    <h3>������ �Ǵ� URL</h3>
95
96      
97
98      <dl>
99        <dt>��Ȳ����:</dt>
100
101        <dd>
102          <p>�� ���ҽ��� ���� ���� URL�� ������ �������� �ִ�.
103          ���� (���� ����ϰ� �˷����� ��) ������ �Ǵ� URL��,
104          ���� Ȥ�� ���� �뵵�� URL�� �ִ�. ����ڰ� ��û��
105          � URL�� ����ϴ��� ������ �Ǵ� URL���� �������
106          �Ѵ�.</p>
107        </dd>
108
109        <dt>�ذ�å:</dt>
110
111        <dd>
112          <p>������ �����ʴ� ��� URL�� ������ �˵��� ��ġ������
113          �ܺ� HTTP �����̷����Ѵ�. ���� ��� �Ʒ� ��Ģ��
114          <code>/~user</code>�� ������ �Ǵ� <code>/u/user</code>��
115          ��ü�ϰ�, <code>/u/user</code> �������� �������� ��ٸ�
116          �߰��Ѵ�.</p>
117
118<div class="example"><pre>
119RewriteRule   ^/<strong>~</strong>([^/]+)/?(.*)    /<strong>u</strong>/$1/$2  [<strong>R</strong>]
120RewriteRule   ^/([uge])/(<strong>[^/]+</strong>)$  /$1/$2<strong>/</strong>   [<strong>R</strong>]
121</pre></div>
122        </dd>
123      </dl>
124
125    
126
127    <h3>������ �Ǵ� ȣ��Ʈ��</h3>
128
129      
130
131      <dl>
132        <dt>��Ȳ����:</dt>
133
134        <dd>...</dd>
135
136        <dt>�ذ�å:</dt>
137
138        <dd>
139<div class="example"><pre>
140RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
141RewriteCond %{HTTP_HOST}   !^$
142RewriteCond %{SERVER_PORT} !^80$
143RewriteRule ^/(.*)         http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R]
144RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
145RewriteCond %{HTTP_HOST}   !^$
146RewriteRule ^/(.*)         http://fully.qualified.domain.name/$1 [L,R]
147</pre></div>
148        </dd>
149      </dl>
150
151    
152
153    <h3><code>DocumentRoot</code>�� �ű� ���</h3>
154
155      
156
157      <dl>
158        <dt>��Ȳ����:</dt>
159
160        <dd>
161          <p>�������� <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>�� ���� URL
162          "<code>/</code>"�� ���� ����ִ�. �׷��� �̰��� ���
163          �ڷᰡ ���� �ʰ�, �ڷᰡ �ٸ� ���� ���� ������ִ�
164          ��찡 �ִ�. ���� ��� ��Ʈ��� ����Ʈ�� (�ܺθ� ����
165          Ȩ������) <code>/e/www/</code>�� (��Ʈ����� ����
166          Ȩ������) <code>/e/sww/</code>�� �ִٰ� ����. ����
167          <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>��
168          <code>/e/www/</code>�̱⶧����, ��û���� ��������
169          ���Ե� �׸� ���� �̰����� �����;� �Ѵ�.</p>
170        </dd>
171
172        <dt>�ذ�å:</dt>
173
174        <dd>
175          <p>�츮�� URL <code>/</code>�� <code>/e/www/</code>��
176          �����̷��Ǹ� �ϸ� �ȴ�. ����� �������� ������
177          <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� ����ؼ��� �����ϴ�.
178          (<code class="module"><a href="/mod/mod_alias.html">mod_alias</a></code> ���� �����ϴ�) URL
179          <em>Alias</em> ���� �������� ����� <em>�պκ�</em>��
180          ��. <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>��
181          ��� URL�� �պκ��̱⶧���� �� ����� ����Ͽ� �����̷�����
182          �� �� ���. <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� ����ϸ�
183          ��¥ �����ϴ�:</p>
184
185<div class="example"><pre>
186RewriteEngine on
187RewriteRule   <strong>^/$</strong>  /e/www/  [<strong>R</strong>]
188</pre></div>
189        </dd>
190      </dl>
191
192    
193
194    <h3>������ ������ ����</h3>
195
196      
197
198      <dl>
199        <dt>��Ȳ����:</dt>
200
201        <dd>
202          <p>���丮�� ��Ī�ϴ� URL�� ������ ������ ������
203          ��ٸ� ��� �����ڴ� ȯȣ�� ���̴�. �������� ��ٸ�,
204          �� <code>/~quux/foo/</code> ��� <code>/~quux/foo</code>��
205          ����ϸ� ������ <code>foo</code>��� <em>����</em>��
206          ã�⶧���� ���� �߻��Ѵ�. ������ ���丮�̱⶧����
207          �޾Ƶ����� �ʴ´�. ��κ��� ��� ���� ������ �ڵ�����
208          URL�� ��ġ����, ���� ���� ����� �� ��찡 �ִ�. ����
209          ���, CGI ��ũ��Ʈ ������ ������ URL ���ۼ��� �� �Ŀ�
210          �׷��ϴ�.</p>
211        </dd>
212
213        <dt>�ذ�å:</dt>
214
215        <dd>
216          <p>�� �̹��� ������ �ذ����� ������ �ڵ����� ������
217          �������� �߰��ϴ� ���̴�. ������ ������ �׸� ����
218          �ùٷ� ��û�� �� �ֵ���, �ܺ� �����̷����� �ؾ� �Ѵ�.
219          ���� �����̷����� �Ѵٸ� ���丮 ���������� �����Ͽ�
220          �� �������� ��� URL�� �����ϴ� �׸��� ������
221          ��û�Ҷ� ã�� �� ���. ���� ���, �ܺ� �����̷�����
222          ������� ������ <code>/~quux/foo/index.html</code>����
223          <code>image.gif</code>�� ��û�ϸ�
224          <code>/~quux/image.gif</code>�� ��û�ϰ� �ȴ�!</p>
225
226          <p>�׷��� �̸� �ذ��ϱ����� ������ ���� �����Ѵ�:</p>
227
228<div class="example"><pre>
229RewriteEngine  on
230RewriteBase    /~quux/
231RewriteRule    ^foo<strong>$</strong>  foo<strong>/</strong>  [<strong>R</strong>]
232</pre></div>
233
234          <p>Ȩ���丮�� �ֻ��� <code>.htaccess</code> ���Ͽ�
235          ������ ���� ������ ���� �ִ�. �׷��� ó���ϴµ� �δ���
236          �ȴ�.</p>
237
238<div class="example"><pre>
239RewriteEngine  on
240RewriteBase    /~quux/
241RewriteCond    %{REQUEST_FILENAME}  <strong>-d</strong>
242RewriteRule    ^(.+<strong>[^/]</strong>)$           $1<strong>/</strong>  [R]
243</pre></div>
244        </dd>
245      </dl>
246
247    
248
249    <h3>�ϰ�� URL ������ ���� ��Ŭ������</h3>
250
251      
252
253      <dl>
254        <dt>��Ȳ����:</dt>
255
256        <dd>
257          <p>��Ʈ��� ���������� ��� �������� �����ϰ� �ϰ��
258          URL ������ ����� �ʹ�. ��, ��� (���ǻ� ������ ���Ͽ�
259          ������ ��������!) URL�� ���� <em>����������</em> �����!
260          �� �̸��� ������������ ������ ������ �ο��ؾ� �Ѵ�:
261          URL�� ���� ������ ��Ī�ϸ� �ȵȴ�. �������� �ڵ�����
262          ���� ������ �����Ѵ�.</p>
263        </dd>
264
265        <dt>�ذ�å:</dt>
266
267        <dd>
268          <p>���� �����, �׷�, ����ü�� ��ġ ������ ������
269          (�л��) �ܺθʿ� ���� ���� ������ ���´�. �ܺθ���
270          ������ ���� ����̴�</p>
271
272<div class="example"><pre>
273user1  server_of_user1
274user2  server_of_user2
275:      :
276</pre></div>
277
278          <p>�츮�� �� ������ ���� <code>map.xxx-to-host</code>
279          ���Ͽ� �����ߴ�. �������� ��� �������� URL�� ������
280          ��ٸ� ������ ���� URL��,</p>
281
282<div class="example"><pre>
283/u/user/anypath
284/g/group/anypath
285/e/entity/anypath
286</pre></div>
287
288          <p>������ ���� �����̷����Ѵ�</p>
289
290<div class="example"><pre>
291http://physical-host/u/user/anypath
292http://physical-host/g/group/anypath
293http://physical-host/e/entity/anypath
294</pre></div>
295
296          <p>�Ʒ� ��Ģ�� �������� ����Ͽ� �� �۾��� �Ѵ� (server0��
297          �ʿ� �׸��� ��� ��� ����� �⺻������� �����Ѵ�):</p>
298
299<div class="example"><pre>
300RewriteEngine on
301
302RewriteMap      user-to-host   txt:/path/to/map.user-to-host
303RewriteMap     group-to-host   txt:/path/to/map.group-to-host
304RewriteMap    entity-to-host   txt:/path/to/map.entity-to-host
305
306RewriteRule   ^/u/<strong>([^/]+)</strong>/?(.*)   http://<strong>${user-to-host:$1|server0}</strong>/u/$1/$2
307RewriteRule   ^/g/<strong>([^/]+)</strong>/?(.*)  http://<strong>${group-to-host:$1|server0}</strong>/g/$1/$2
308RewriteRule   ^/e/<strong>([^/]+)</strong>/?(.*) http://<strong>${entity-to-host:$1|server0}</strong>/e/$1/$2
309
310RewriteRule   ^/([uge])/([^/]+)/?$          /$1/$2/.www/
311RewriteRule   ^/([uge])/([^/]+)/([^.]+.+)   /$1/$2/.www/$3\
312</pre></div>
313        </dd>
314      </dl>
315
316    
317
318    <h3>Ȩ���丮�� �ٸ� �������� ����</h3>
319
320      
321
322      <dl>
323        <dt>��Ȳ����:</dt>
324
325        <dd>
326          <p>���� �����ڴ� �������� ��� Ȩ���丮�� �ٸ�
327          �������� ������ ��� �ذ�å�� �����. �� �����
328          ���� ������ ��ü�� ���ο� ������ �����ϴµ� �ð���
329          �ɸ��� ��쿡 �ʿ��ϴ�.</p>
330        </dd>
331
332        <dt>�ذ�å:</dt>
333
334        <dd>
335          <p><code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� ����ϸ� �����ϴ�.
336          ���� �������� ��� <code>/~user/anypath</code> URL��
337          <code>http://newserver/~user/anypath</code>��
338          �����̷����ϸ� �ȴ�.</p>
339
340<div class="example"><pre>
341RewriteEngine on
342RewriteRule   ^/~(.+)  http://<strong>newserver</strong>/~$1  [R,L]
343</pre></div>
344        </dd>
345      </dl>
346
347    
348
349    <h3>Ȩ���丮 ���� �����</h3>
350
351      
352
353      <dl>
354        <dt>��Ȳ����:</dt>
355
356        <dd>
357          <p>����ڰ� ��õ���� ����Ʈ�� ���� Ȩ���丮 ������
358          �����. ��, ���� ��� �̸��� ����ڸ��� ù��° ������
359          �������丮�� Ȩ���丮�� �д�. �׷���,
360          <code>/~foo/anypath</code>��
361          <code>/home/<strong>f</strong>/foo/.www/anypath</code>�̰�,
362          <code>/~bar/anypath</code>��
363          <code>/home/<strong>b</strong>/bar/.www/anypath</code>�̴�.</p>
364        </dd>
365
366        <dt>�ذ�å:</dt>
367
368        <dd>
369          <p>����ǥ�ð� �ִ� URL�� ���� ���� ������ ��ȯ�ϱ�����
370          ���� ��Ģ�� ����Ѵ�.</p>
371
372<div class="example"><pre>
373RewriteEngine on
374RewriteRule   ^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*)  /home/<strong>$2</strong>/$1/.www$3
375</pre></div>
376        </dd>
377      </dl>
378
379    
380
381    <h3>���Ͻý��� �籸��</h3>
382
383      
384
385      <dl>
386        <dt>��Ȳ����:</dt>
387
388        <dd>
389          <p>�� ���� �Ƿ� �ϵ��ھ����̴�: ���丮��
390          <code>RewriteRules</code>�� �ſ� ���� ����Ͽ� �ڷ�
391          ��ü�� �״�� ��ü�� ���� �ڷḦ �ڿ������� ����¡�ϵ���
392          �Ѵ�. ���: ���� 1992�� ���� �����Ӱ� ����� �� �ִ�
393          ���н� ����Ʈ������� <strong><em>net.sw</em></strong>��
394          ��Ƶΰ� �־��. �̴� ���� ��ǻ�Ͱ����� ����ϸ鼭
395          �����ص��� �����ð��� �ý��� ���ڿ� ��Ʈ�� ���ڸ�
396          �ؿԱ⶧���� �� ������� ���̴�. ���ָ��� ���� ����Ʈ���
397          �߰��� ������ ���丮�� ��� �����Դ�:</p>
398
399<div class="example"><pre>
400drwxrwxr-x   2 netsw  users    512 Aug  3 18:39 Audio/
401drwxrwxr-x   2 netsw  users    512 Jul  9 14:37 Benchmark/
402drwxrwxr-x  12 netsw  users    512 Jul  9 00:34 Crypto/
403drwxrwxr-x   5 netsw  users    512 Jul  9 00:41 Database/
404drwxrwxr-x   4 netsw  users    512 Jul 30 19:25 Dicts/
405drwxrwxr-x  10 netsw  users    512 Jul  9 01:54 Graphic/
406drwxrwxr-x   5 netsw  users    512 Jul  9 01:58 Hackers/
407drwxrwxr-x   8 netsw  users    512 Jul  9 03:19 InfoSys/
408drwxrwxr-x   3 netsw  users    512 Jul  9 03:21 Math/
409drwxrwxr-x   3 netsw  users    512 Jul  9 03:24 Misc/
410drwxrwxr-x   9 netsw  users    512 Aug  1 16:33 Network/
411drwxrwxr-x   2 netsw  users    512 Jul  9 05:53 Office/
412drwxrwxr-x   7 netsw  users    512 Jul  9 09:24 SoftEng/
413drwxrwxr-x   7 netsw  users    512 Jul  9 12:17 System/
414drwxrwxr-x  12 netsw  users    512 Aug  3 20:15 Typesetting/
415drwxrwxr-x  10 netsw  users    512 Jul  9 14:08 X11/
416</pre></div>
417
418          <p>1996�� 7�� �� ����Ҹ� ���ִ� �� �������̽��� ����
419          ���� ���ϱ�� �����޴�. "���ִ�"�� ����, �ֻ���
420          ���丮�� CGI ��ũ��Ʈ�� ���� �ʰ�, ����� ����������
421          ���� �������ϱ� �ٶ��ٴ� ���̴�. ��? ����Ҹ� ���߿�
422          FTP�ε� ������ �� �ֵ��� ���� �����̿��⶧���� ���̳�
423          CGI�� ��õ� ������ ���� �α� �Ⱦ��.</p>
424        </dd>
425
426        <dt>�ذ�å:</dt>
427
428        <dd>
429          <p>�ذ�å�� �� �κ����� ������: ���� ���丮 ���ؿ���
430          �ʿ��� ��� �������� �������� ����� CGI ��ũ��Ʈ��
431          �ʿ��ϴ�. ���� �� ��ũ��Ʈ���� ������ ����
432          <code>/e/netsw/.www/</code>�� ��:</p>
433
434<div class="example"><pre>
435-rw-r--r--   1 netsw  users    1318 Aug  1 18:10 .wwwacl
436drwxr-xr-x  18 netsw  users     512 Aug  5 15:51 DATA/
437-rw-rw-rw-   1 netsw  users  372982 Aug  5 16:35 LOGFILE
438-rw-r--r--   1 netsw  users     659 Aug  4 09:27 TODO
439-rw-r--r--   1 netsw  users    5697 Aug  1 18:01 netsw-about.html
440-rwxr-xr-x   1 netsw  users     579 Aug  2 10:33 netsw-access.pl
441-rwxr-xr-x   1 netsw  users    1532 Aug  1 17:35 netsw-changes.cgi
442-rwxr-xr-x   1 netsw  users    2866 Aug  5 14:49 netsw-home.cgi
443drwxr-xr-x   2 netsw  users     512 Jul  8 23:47 netsw-img/
444-rwxr-xr-x   1 netsw  users   24050 Aug  5 15:49 netsw-lsdir.cgi
445-rwxr-xr-x   1 netsw  users    1589 Aug  3 18:43 netsw-search.cgi
446-rwxr-xr-x   1 netsw  users    1885 Aug  1 17:41 netsw-tree.cgi
447-rw-r--r--   1 netsw  users     234 Jul 30 16:35 netsw-unlimit.lst
448</pre></div>
449
450          <p><code>DATA/</code> �������丮�� ������ ���� ����Ұ�
451          �ִ�. ���� <strong><em>net.sw</em></strong>�� ������ ����
452          <code>rdist</code>�� ����Ͽ� �ڵ����� �����´�. �ι�°
453          �κ��� ���Ҵ�: ��� �� �� ������ �ϳ��� �ڿ�������
454          URL ������ �����ϴ°�? ����ڿ��� <code>DATA/</code>
455          ���丮�� ���߰�, URL���� ������ CGI ��ũ��Ʈ�� �����ϰ�
456          �ʹ�. �ذ�å�� ������ ����: ���� ������ <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>���� ���
457          URL <code>/net.sw/</code>�� ���� ��� <code>/e/netsw</code>��
458          ���ۼ��ϱ����� ���丮�� �������Ͽ� ������ ���� �����Ѵ�:</p>
459
460<div class="example"><pre>
461RewriteRule  ^net.sw$       net.sw/        [R]
462RewriteRule  ^net.sw/(.*)$  e/netsw/$1
463</pre></div>
464
465          <p>ù��° ��Ģ�� �������� �������� ��� ��û�� ���ؼ�
466          ����ߴ�! �ι�° ��Ģ�� ���� �۾��� �Ѵ�. �׸��� ���丮��
467          �������� <code>/e/netsw/.www/.wwwacl</code>�� ��������
468          ������ ���´�:</p>
469
470<div class="example"><pre>
471Options       ExecCGI FollowSymLinks Includes MultiViews
472
473RewriteEngine on
474
475#  �� �κ��� /net.sw/ �� �����Ѵ�
476RewriteBase   /net.sw/
477
478#  ���� �ֻ��� ���丮��
479#  cgi ��ũ��Ʈ�� ���ۼ��Ѵ�
480RewriteRule   ^$                       netsw-home.cgi     [L]
481RewriteRule   ^index\.html$            netsw-home.cgi     [L]
482
483#  ������ ���丮�� �������� ��û�� ���
484#  �������丮�� �����Ѵ�
485RewriteRule   ^.+/(netsw-[^/]+/.+)$    $1                 [L]
486
487#  ���� ���ۼ��� ��ģ��
488RewriteRule   ^netsw-home\.cgi.*       -                  [L]
489RewriteRule   ^netsw-changes\.cgi.*    -                  [L]
490RewriteRule   ^netsw-search\.cgi.*     -                  [L]
491RewriteRule   ^netsw-tree\.cgi$        -                  [L]
492RewriteRule   ^netsw-about\.html$      -                  [L]
493RewriteRule   ^netsw-img/.*$           -                  [L]
494
495#  �ٸ� cgi ��ũ��Ʈ�� ó����
496#  �������丮�� ���Ҵ�
497RewriteRule   !^netsw-lsdir\.cgi.*     -                  [C]
498RewriteRule   (.*)                     netsw-lsdir.cgi/$1
499</pre></div>
500
501          <p>�ؼ��� ���� ��Ʈ:</p>
502
503          <ol>
504            <li>�׹�° �κп��� ��ü �ʵ�('<code>-</code>')��
505            ��� <code>L</code> (last) �÷��װ� ������ �ָ��϶�</li>
506
507            <li>������ �κп��� ù��° ��Ģ�� <code>!</code>
508            (not) ���ڿ� <code>C</code> (chain) �÷��׸� �ָ��϶�</li>
509
510            <li>������ ��Ģ���� ��Ÿ �ش����� �ʴ� ��� ��츦
511            ��Ƴ��� ������ �ָ��϶�</li>
512          </ol>
513        </dd>
514      </dl>
515
516    
517
518    <h3>NCSA imagemap�� ����ġ <code>mod_imagemap</code>����</h3>
519
520      
521
522      <dl>
523        <dt>��Ȳ����:</dt>
524
525        <dd>
526          <p>������� NCSA ���������� �������� ����ġ ��������
527          �ڿ������� �Űܰ��� �ٶ���. �׷��� ������ NCSA
528          <code>imagemap</code> ���α׷��� ����� �������� ��������
529          ����ġ <code class="module"><a href="/mod/mod_imagemap.html">mod_imagemap</a></code>�� ó���ϱ� �ٶ���.
530          ������ <code>imagemap</code> ���α׷���
531          <code>/cgi-bin/imagemap/path/to/page.map</code>��
532          ���� �����ϴ� �����۸�ũ�� ���ٴ� ���̴�. ����ġ��
533          <code>/path/to/page.map</code>�� ���� ��û�� �޾ƾ�
534          �Ѵ�.</p>
535        </dd>
536
537        <dt>�ذ�å:</dt>
538
539        <dd>
540          <p>��� ��û���� �պκ��� �������� �����ϴ� �� ��Ģ��
541          ����Ѵ�:</p>
542
543<div class="example"><pre>
544RewriteEngine  on
545RewriteRule    ^/cgi-bin/imagemap(.*)  $1  [PT]
546</pre></div>
547        </dd>
548      </dl>
549
550    
551
552    <h3>���� ���丮���� ������ �˻�</h3>
553
554      
555
556      <dl>
557        <dt>��Ȳ����:</dt>
558
559        <dd>
560          <p>���� �������� ���� ���丮���� ������ ã�ƾ� ��
561          ���� �ִ�. �� ��� MultiViews�� �ٸ� ����� ������
562          �ȵȴ�.</p>
563        </dd>
564
565        <dt>�ذ�å:</dt>
566
567        <dd>
568          <p>���� ���丮���� ������ ã�� ��Ģ�� ���� ���α׷��Ѵ�.</p>
569
570<div class="example"><pre>
571RewriteEngine on
572
573#   ���� custom/���� ã�� �õ��ϰ�...
574#   ...��� ��!
575RewriteCond         /your/docroot/<strong>dir1</strong>/%{REQUEST_FILENAME}  -f
576RewriteRule  ^(.+)  /your/docroot/<strong>dir1</strong>/$1  [L]
577
578#   �ι�°�� pub/���� ã�� �õ��Ѵ�...
579#   ...��� ��!
580RewriteCond         /your/docroot/<strong>dir2</strong>/%{REQUEST_FILENAME}  -f
581RewriteRule  ^(.+)  /your/docroot/<strong>dir2</strong>/$1  [L]
582
583#   ��ã���� �ٸ� Alias�� ScriptAlias ���þ� ������ �����Ѵ�.
584RewriteRule   ^(.+)  -  [PT]
585</pre></div>
586        </dd>
587      </dl>
588
589    
590
591    <h3>URL�� ��� ȯ�溯���� �����Ѵ�</h3>
592
593      
594
595      <dl>
596        <dt>��Ȳ����:</dt>
597
598        <dd>
599          <p>��û�鰣�� ���������� �����ϱ����� URL�� ������
600          ���ڵ��ϴ� ��� �ִ�. �׷��� ���� �� ������ �����ϱ�����
601          ��� �������� CGI wrapper�� ����ϰ� ���� �ʴ�.</p>
602        </dd>
603
604        <dt>�ذ�å:</dt>
605
606        <dd>
607          <p>���ۼ� ��Ģ�� ����Ͽ� ���������� �����ϰ�, ������
608          ������ ���߿� XSSI�� CGI���� ����ϱ����� ȯ�溯����
609          �����Ѵ�. �׷��� URL <code>/foo/S=java/bar/</code>��
610          <code>/foo/bar/</code>�� ��ȯ�ǰ� <code>STATUS</code>���
611          ȯ�溯�� ���� "java"�� �����Ѵ�.</p>
612
613<div class="example"><pre>
614RewriteEngine on
615RewriteRule   ^(.*)/<strong>S=([^/]+)</strong>/(.*)    $1/$3 [E=<strong>STATUS:$2</strong>]
616</pre></div>
617        </dd>
618      </dl>
619
620    
621
622    <h3>���� ����� ȣ��Ʈ</h3>
623
624      
625
626      <dl>
627        <dt>��Ȳ����:</dt>
628
629        <dd>
630          <p>����ȣ��Ʈ�� ������� �ʰ� ���� ��ǻ�ͷ� DNS A
631          ���ڵ带 �����Ͽ�
632          <code>www.<strong>username</strong>.host.domain.com</code>��
633          ������� Ȩ�������� �����ϰ� �ʹ�.</p>
634        </dd>
635
636        <dt>�ذ�å:</dt>
637
638        <dd>
639          <p>HTTP/1.0 ��û�� ��� ����� ������, Host: HTTP
640          ����� ������ HTTP/1.1 ��û�� ���� ��Ģ�� ����Ͽ�
641          ���������� <code>http://www.username.host.com/anypath</code>��
642          <code>/home/username/anypath</code>�� ���ۼ��� ��
643          �ִ�:</p>
644
645<div class="example"><pre>
646RewriteEngine on
647RewriteCond   %{<strong>HTTP_HOST</strong>}                 ^www\.<strong>[^.]+</strong>\.host\.com$
648RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
649RewriteRule   ^www\.<strong>([^.]+)</strong>\.host\.com(.*) /home/<strong>$1</strong>$2
650</pre></div>
651        </dd>
652      </dl>
653
654    
655
656    <h3>Ȩ���丮�� �ܺ� ������ �����̷���</h3>
657
658      
659
660      <dl>
661        <dt>��Ȳ����:</dt>
662
663        <dd>
664          <p>���� ������ <code>ourdomain.com</code> �ۿ��� ��û��
665          ������ Ȩ���丮 URL�� �ٸ� ������
666          <code>www.somewhere.com</code>���� ���ٸ������ϱ�
667          �ٶ���. ���� ����ȣ��Ʈ �����ҿ��� ����Ѵ�.</p>
668        </dd>
669
670        <dt>�ذ�å:</dt>
671
672        <dd>
673          <p>���ۼ� ������ ����ϸ� �ȴ�:</p>
674
675<div class="example"><pre>
676RewriteEngine on
677RewriteCond   %{REMOTE_HOST}  <strong>!^.+\.ourdomain\.com$</strong>
678RewriteRule   ^(/~.+)         http://www.somewhere.com/$1 [R,L]
679</pre></div>
680        </dd>
681      </dl>
682
683    
684
685    <h3>������ URL�� �ٸ� �������� �����̷���</h3>
686
687      
688
689      <dl>
690        <dt>��Ȳ����:</dt>
691
692        <dd>
693          <p>URL ���ۼ��� ���ؼ� ������ A�� �ش� ������ ���
694          ��� ������ B�� ��û�� �����̷����ϴ� ����� ����
695          �����. ���� Perl�� �ۼ��� <code class="directive"><a href="/mod/core.html#errordocument">ErrorDocument</a></code> CGI ��ũ��Ʈ��
696          ���������, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� ����ϴ�
697          ��� �ִ�. �׷��� ������ <code class="directive"><a href="/mod/core.html#errordocument">ErrorDocument</a></code> CGI ��ũ��Ʈ����
698          �������� ����϶�!</p>
699        </dd>
700
701        <dt>�ذ�å:</dt>
702
703        <dd>
704          <p>ù��° ����� ������ �������� �������� ��������
705          �ʴ�:</p>
706
707<div class="example"><pre>
708RewriteEngine on
709RewriteCond   /your/docroot/%{REQUEST_FILENAME} <strong>!-f</strong>
710RewriteRule   ^(.+)                             http://<strong>webserverB</strong>.dom/$1
711</pre></div>
712
713          <p>�� ����� ������ <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code> �ȿ� �ִ� ��������
714          �����ϴٴ� ���̴�. (���� ��� Ȩ���丮 ���� ����)
715          ������ �߰��� �� ������, �� ���� ����� �ִ�:</p>
716
717<div class="example"><pre>
718RewriteEngine on
719RewriteCond   %{REQUEST_URI} <strong>!-U</strong>
720RewriteRule   ^(.+)          http://<strong>webserverB</strong>.dom/$1
721</pre></div>
722
723          <p><code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� URL �������(look-ahead)��
724          ����Ѵ�. �׷��� ��� URL�� �����ϰ� �����ϴ�. �׷���
725          ��� ��û���� ���� ������û�� �ѹ� �� �ϱ⶧���� ������
726          ���ɿ� �ǿ����� �ش�. �׷��� ������ CPU���� ��������
727          �����Ѵٸ� ����϶�. ��ǻ�Ͱ� �����ٸ� ù��° ����̳�
728          �� ���� <code class="directive"><a href="/mod/core.html#errordocument">ErrorDocument</a></code>
729          CGI ��ũ��Ʈ�� ����϶�.</p>
730        </dd>
731      </dl>
732
733    
734
735    <h3>Ȯ�� �����̷���</h3>
736
737      
738
739      <dl>
740        <dt>��Ȳ����:</dt>
741
742        <dd>
743          <p>���� �����̷����ϴ� URL�� �� ������ �ʿ䰡 �ִ�.
744          ����ġ ���� URL escape �Լ��� "<code>url#anchor</code>"
745          ���� URL�� anchor�� escape�Ѵ�. ����ġ��
746          <code>uri_escape()</code> �Լ��� �칰����(#)�� ����
747          escape�ϹǷ� ����� �� ���. �׷��� ��� �̷� URL��
748          �����̷����� �� �ֳ�?</p>
749        </dd>
750
751        <dt>�ذ�å:</dt>
752
753        <dd>
754          <p>���� �����̷����ϴ� NPH-CGI ��ũ��Ʈ�� ����� �ذ�å��
755          �ʿ��ϴ�. escape�� ���� �ʱ⶧���̴� (NPH=non-parseable
756          headers). ���� ���� ���������� �Ͽ� (���ۼ� ��Ģ��
757          ���κп� ����ؾ� �Ѵ�) ���ο� URL scheme
758          <code>xredirect:</code>�� �����Ѵ�:</p>
759
760<div class="example"><pre>
761RewriteRule ^xredirect:(.+) /path/to/nph-xredirect.cgi/$1 \
762            [T=application/x-httpd-cgi,L]
763</pre></div>
764
765          <p>�׷��� <code>xredirect:</code>�� �����ϴ� ��� URL��
766          <code>nph-xredirect.cgi</code> ���α׷��� ���ϰ� �ȴ�.
767          ���α׷��� ������ ����:</p>
768
769<div class="example"><pre>
770#!/path/to/perl
771##
772##  nph-xredirect.cgi -- NPH/CGI script for extended redirects
773##  Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved.
774##
775
776$| = 1;
777$url = $ENV{'PATH_INFO'};
778
779print "HTTP/1.0 302 Moved Temporarily\n";
780print "Server: $ENV{'SERVER_SOFTWARE'}\n";
781print "Location: $url\n";
782print "Content-type: text/html\n";
783print "\n";
784print "&lt;html&gt;\n";
785print "&lt;head&gt;\n";
786print "&lt;title&gt;302 Moved Temporarily (EXTENDED)&lt;/title&gt;\n";
787print "&lt;/head&gt;\n";
788print "&lt;body&gt;\n";
789print "&lt;h1&gt;Moved Temporarily (EXTENDED)&lt;/h1&gt;\n";
790print "The document has moved &lt;a HREF=\"$url\"&gt;here&lt;/a&gt;.&lt;p&gt;\n";
791print "&lt;/body&gt;\n";
792print "&lt;/html&gt;\n";
793
794##EOF##
795</pre></div>
796
797          <p>�׷��� <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� ���� �������ϴ�
798          ��� URL scheme���� �����̷����� �� �ִ�. ���� ���,
799          ������ ���� <code>news:newsgroup</code>���� �����̷�����
800          �� �ִ�</p>
801
802<div class="example"><pre>
803RewriteRule ^anyurl  xredirect:news:newsgroup
804</pre></div>
805
806          <div class="note">����: ���� Ư���� "���" ��Ģ�� ����Ͽ�
807          <code>xredirect:</code>�� �������� Ȯ���ؾ� �ϱ⶧����
808          ��Ģ�� <code>[R]</code>�̳� <code>[R,L]</code>�� ����ϸ�
809          �ȵȴ�.</div>
810        </dd>
811      </dl>
812
813    
814
815    <h3>����� ���� �߰�(multiplexer)</h3>
816
817      
818
819      <dl>
820        <dt>��Ȳ����:</dt>
821
822        <dd>
823          <p><a href="http://www.perl.com/CPAN">http://www.perl.com/CPAN</a>��
824          �ִ� ����� CPAN (Comprehensive Perl Archive Network)��
825          �ƴ°�? �� �ּҴ� ���迡 ����� ���� CPAN �̷� FTP
826          ������ Ŭ���̾�Ʈ�� ������ �ִ� ������ �����̷����Ѵ�.
827          �̸� FTP ���� �߰� ������� �Ѵ�. CPAN�� CGI ��ũ��Ʈ��
828          ���������, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� ����Ͽ�
829          ����ϰ� ���� �� ������?</p>
830        </dd>
831
832        <dt>�ذ�å:</dt>
833
834        <dd>
835          <p>���� <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> 3.0.0 �������
836          �����̷��ǿ� "<code>ftp:</code>" scheme�� ����� ��
837          �ִ�. �������� Ŭ���̾�Ʈ�� �ֻ��� �������� <code class="directive"><a href="/mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>�� ����
838          ����Ͽ� ��ġ�� ������ �� �ִ�. ������ ���� ��Ģ����
839          �ֻ��� �������� �߰���� Ű�� ����Ѵ�.</p>
840
841<div class="example"><pre>
842RewriteEngine on
843RewriteMap    multiplex                txt:/path/to/map.cxan
844RewriteRule   ^/CxAN/(.*)              %{REMOTE_HOST}::$1                 [C]
845RewriteRule   ^.+\.<strong>([a-zA-Z]+)</strong>::(.*)$  ${multiplex:<strong>$1</strong>|ftp.default.dom}$2  [R,L]
846</pre></div>
847
848<div class="example"><pre>
849##
850##  map.cxan -- Multiplexing Map for CxAN
851##
852
853de        ftp://ftp.cxan.de/CxAN/
854uk        ftp://ftp.cxan.uk/CxAN/
855com       ftp://ftp.cxan.com/CxAN/
856 :
857##EOF##
858</pre></div>
859        </dd>
860      </dl>
861
862    
863
864    <h3>�ð��� �� ���ۼ�</h3>
865
866      
867
868      <dl>
869        <dt>��Ȳ����:</dt>
870
871        <dd>
872          <p>�ð��� ��� �ٸ� ������ �����ϴ� ��� ���� �����ڴ�
873          ��� Ư���� �������� �����̷����ϱ����� CGI ��ũ��Ʈ��
874          ����Ѵ�. <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�δ� ���
875          �� �� �ִ°�?</p>
876        </dd>
877
878        <dt>�ذ�å:</dt>
879
880        <dd>
881          <p>���ۼ� ���ǿ��� ����� �� �ִ� ���� <code>TIME_xxx</code>
882          ������ �ִ�. ������ Ư���� ����� ��
883          <code>&lt;STRING</code>, <code>&gt;STRING</code>,
884          <code>=STRING</code>�� ����Ͽ� �ð��� ��� �����̷�����
885          �� �ִ�:</p>
886
887<div class="example"><pre>
888RewriteEngine on
889RewriteCond   %{TIME_HOUR}%{TIME_MIN} &gt;0700
890RewriteCond   %{TIME_HOUR}%{TIME_MIN} &lt;1900
891RewriteRule   ^foo\.html$             foo.day.html
892RewriteRule   ^foo\.html$             foo.night.html
893</pre></div>
894
895          <p>URL <code>foo.html</code>�� ��û�ϸ�
896          <code>07:00-19:00</code> ���� <code>foo.day.html</code>
897          ������ �����ϰ�, ������ �ð� ����
898          <code>foo.night.html</code> ������ �����Ѵ�. Ȩ����������
899          ����ϱ� ���� ����̴�...</p>
900        </dd>
901      </dl>
902
903    
904
905    <h3>YYYY�� XXXX�� ������ ��� ��ȣȯ</h3>
906
907      
908
909      <dl>
910        <dt>��Ȳ����:</dt>
911
912        <dd>
913          <p>���� <code>.html</code> ������ <code>.phtml</code>��
914          ��ȯ�ϴ� �� <code>document.YYYY</code>��
915          <code>document.XXXX</code>�� �������� ��ȣȯ(backward
916          compatibility) URL�� (���������� �����ϰ�) ���� ��
917          �ֳ�?</p>
918        </dd>
919
920        <dt>�ذ�å:</dt>
921
922        <dd>
923          <p>�̸��� �⺻�̸����� ���ۼ����� ���ο� Ȯ���ڸ�
924          ���� ������ �ִ��� �˻��Ѵ�. �ִٸ� �� ���ϸ��� ����ϰ�,
925          ������ URL�� �� ���·� ���ۼ��Ѵ�.</p>
926
927
928<div class="example"><pre>
929#   ����.html �� ���
930#   ����.phtml �� �ִ� ���
931#   ����.html �� ����.phtml ��
932#   ���ۼ��ϴ� ��ȣȯ ��Ģ
933RewriteEngine on
934RewriteBase   /~quux/
935#   �⺻�̸��� ã��, ã�Ҵٴ� ����� ����Ѵ�
936RewriteRule   ^(.*)\.html$              $1      [C,E=WasHTML:yes]
937#   ������ �ִٸ� ����.phtml �� ���ۼ��Ѵ�
938RewriteCond   %{REQUEST_FILENAME}.phtml -f
939RewriteRule   ^(.*)$ $1.phtml                   [S=1]
940#   �ƴϸ� �տ��� ã�� �⺻�̸��� �ǵ�����
941RewriteCond   %{ENV:WasHTML}            ^yes$
942RewriteRule   ^(.*)$ $1.html
943</pre></div>
944        </dd>
945      </dl>
946
947    
948
949  </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
950<div class="section">
951<h2><a name="content" id="content">������ �ٷ��</a></h2>
952
953    
954
955    <h3>���� ���� (���߱�)</h3>
956
957      
958
959      <dl>
960        <dt>��Ȳ����:</dt>
961
962        <dd>
963          <p>�ֱ� <code>foo.html</code>�� <code>bar.html</code>��
964          �����ϰ� ��ȣȯ���� ���� ���� URL�� ��� �����ϰ�
965          �ʹٰ� ��������. ����ڴ� ���� URL�� ����Ǿ�ٴ�
966          ����� ��ġä�� ���Ѵ�.</p>
967        </dd>
968
969        <dt>�ذ�å:</dt>
970
971        <dd>
972          <p>���� ��Ģ���� ���� URL�� ���������� ���ο� URL��
973          ���ۼ��Ѵ�:</p>
974
975<div class="example"><pre>
976RewriteEngine  on
977RewriteBase    /~quux/
978RewriteRule    ^<strong>foo</strong>\.html$  <strong>bar</strong>.html
979</pre></div>
980        </dd>
981      </dl>
982
983    
984
985    <h3>���� ���� (�˸���)</h3>
986
987      
988
989      <dl>
990        <dt>��Ȳ����:</dt>
991
992        <dd>
993          <p>�ٽ� <code>foo.html</code>�� <code>bar.html</code>��
994          �����ϰ� ��ȣȯ���� ���� ���� URL�� ��� �����ϰ�
995          �ʹٰ� ��������. �׷��� ������ ���� URL�� ����ϸ�
996          ����ڿ��� ���ο� URL�� ��Ʈ�� �˷��ش�. ��, ������
997          �ּ�â�� ���Ѵ�.</p>
998        </dd>
999
1000        <dt>�ذ�å:</dt>
1001
1002        <dd>
1003          <p>���ο� URL�� HTTP �����̷����ϴ�. �׷��� ������
1004          ���ο� URL�� ���̰� �������� ����ڰ� �˰Եȴ�:</p>
1005
1006<div class="example"><pre>
1007RewriteEngine  on
1008RewriteBase    /~quux/
1009RewriteRule    ^<strong>foo</strong>\.html$  <strong>bar</strong>.html  [<strong>R</strong>]
1010</pre></div>
1011        </dd>
1012      </dl>
1013
1014    
1015
1016    <h3>������ �� ����</h3>
1017
1018      
1019
1020      <dl>
1021        <dt>��Ȳ����:</dt>
1022
1023        <dd>
1024          <p>�ּ��� �߿��� �ֻ��� �������� ������ ����ȭ��
1025          �������� �����ؾ��� ��찡 �ִ�. ��, �ֽ� Netscape
1026          ������Դ� �ֻ��� ������, Lynx ������Դ�
1027          ���� ������, ������ ������� ������� ������
1028          �����Ѵ�.</p>
1029        </dd>
1030
1031        <dt>�ذ�å:</dt>
1032
1033        <dd>
1034          <p>������ ��������� ���� �ڽ��� ���� ���� ������
1035          �������� �ʱ⶧���� ��������� ����� �� ���. ���
1036          HTTP "User-Agent" ����� ����Ѵ�. ���� ��Ģ�� HTTP
1037          "User-Agent" ����� "Mozilla/3"���� �����ϸ�
1038          <code>foo.html</code> �������� <code>foo.NS.html</code>��
1039          ���ۼ��ϰ� ���ۼ��� �ߴ��Ѵ�. ������ "Lynx"��
1040          "Mozilla" ���� 1 Ȥ�� 2��� URL��
1041          <code>foo.20.html</code>�� �ȴ�. ������ �������
1042          <code>foo.32.html</code> �������� �޴´�. �Ʒ� ��Ģ��
1043          �� �۾��� �Ѵ�:</p>
1044
1045<div class="example"><pre>
1046RewriteCond %{HTTP_USER_AGENT}  ^<strong>Mozilla/3</strong>.*
1047RewriteRule ^foo\.html$         foo.<strong>NS</strong>.html          [<strong>L</strong>]
1048
1049RewriteCond %{HTTP_USER_AGENT}  ^<strong>Lynx/</strong>.*         [OR]
1050RewriteCond %{HTTP_USER_AGENT}  ^<strong>Mozilla/[12]</strong>.*
1051RewriteRule ^foo\.html$         foo.<strong>20</strong>.html          [<strong>L</strong>]
1052
1053RewriteRule ^foo\.html$         foo.<strong>32</strong>.html          [<strong>L</strong>]
1054</pre></div>
1055        </dd>
1056      </dl>
1057
1058    
1059
1060    <h3>���� �̷�</h3>
1061
1062      
1063
1064      <dl>
1065        <dt>��Ȳ����:</dt>
1066
1067        <dd>
1068          <p>�ܺ� ȣ��Ʈ�� �츮 ����Ʈ�� �������� ���� ����
1069          ���������� �ִٰ� ��������. FTP ������ ��� ���� �ܺ�
1070          �ڷ��� �ֽź��纻�� �����ϴ� <code>mirror</code> ���α׷���
1071          ����� �� �ְ�, ��������� HTTP�� ����� �۾��� �ϴ�
1072          <code>webcopy</code> ���α׷��� ����� �� �ִ�. �׷���
1073          �� ��� ��� ������ �ִ�: ���纻�� ���� ���α׷���
1074          �������� ���� �ֽ������� �����ȴ�. ���� �����ؾ��ϴ�
1075          ������ �̷��� �ƴ϶�� ���ڴ�. ��� (�ܺ� ȣ��Ʈ����
1076          �ڷᰡ ���ŵǸ�) �ʿ��Ҷ� �ڵ����� �ڷḦ �����ϴ�
1077          ���� �̷��� �ʿ��ϴ�.</p>
1078        </dd>
1079
1080        <dt>�ذ�å:</dt>
1081
1082        <dd>
1083          <p>�̸� ���� <dfn>Proxy Throughput</dfn> ����� (�÷���
1084          <code>[P]</code>) ����Ͽ� �ܺ� �������� Ȥ�� �ܺ�
1085          ���� ��ü�� �츮 �̸������� �����Ѵ�:</p>
1086
1087<div class="example"><pre>
1088RewriteEngine  on
1089RewriteBase    /~quux/
1090RewriteRule    ^<strong>hotsheet/</strong>(.*)$  <strong>http://www.tstimpreso.com/hotsheet/</strong>$1  [<strong>P</strong>]
1091</pre></div>
1092
1093<div class="example"><pre>
1094RewriteEngine  on
1095RewriteBase    /~quux/
1096RewriteRule    ^<strong>usa-news\.html</strong>$   <strong>http://www.quux-corp.com/news/index.html</strong>  [<strong>P</strong>]
1097</pre></div>
1098        </dd>
1099      </dl>
1100
1101    
1102
1103    <h3>���� ���̷�</h3>
1104
1105      
1106
1107      <dl>
1108        <dt>��Ȳ����:</dt>
1109
1110        <dd>...</dd>
1111
1112        <dt>�ذ�å:</dt>
1113
1114        <dd>
1115<div class="example"><pre>
1116RewriteEngine on
1117RewriteCond   /mirror/of/remotesite/$1           -U
1118RewriteRule   ^http://www\.remotesite\.com/(.*)$ /mirror/of/remotesite/$1
1119</pre></div>
1120        </dd>
1121      </dl>
1122
1123    
1124
1125    <h3>��� �ڷḦ ��Ʈ��ݿ��� ��������</h3>
1126
1127      
1128
1129      <dl>
1130        <dt>��Ȳ����:</dt>
1131
1132        <dd>
1133          <p>���� �ڷḦ ��ȭ���� ��ȣ�ϴ� (����) ��Ʈ��� ��������
1134          (<code>www2.quux-corp.dom</code>) �����ϸ鼭, �����
1135          (�ܺ�) ���ͳ� �������� (<code>www.quux-corp.dom</code>)
1136          �����ϴ� ��ó�� ���̰� �Ѵ�. �ܺ� �������� ��û��
1137          �ڷḦ ���� ���������� �����´�.</p>
1138        </dd>
1139
1140        <dt>�ذ�å:</dt>
1141
1142        <dd>
1143          <p>���� ��ȭ���� ���� �������� ��ȣ�ϰ� �ܺ� ����������
1144          ���� ���������� �ڷḦ ���� �� �ְ� �Ѵ�. ������ ����
1145          ��Ŷ���͸� ��ȭ���� �����Ѵ�:</p>
1146
1147<div class="example"><pre>
1148<strong>ALLOW</strong> Host www.quux-corp.dom Port &gt;1024 --&gt; Host www2.quux-corp.dom Port <strong>80</strong>
1149<strong>DENY</strong>  Host *                 Port *     --&gt; Host www2.quux-corp.dom Port <strong>80</strong>
1150</pre></div>
1151
1152          <p>���� �������� �˸°� ���Ķ�. ��� �ڷḦ ����������
1153          proxy throughput ����� ���� ��û�ϴ�
1154          <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> ��Ģ�� �ۼ��Ѵ�:</p>
1155
1156<div class="example"><pre>
1157RewriteRule ^/~([^/]+)/?(.*)          /home/$1/.www/$2
1158RewriteCond %{REQUEST_FILENAME}       <strong>!-f</strong>
1159RewriteCond %{REQUEST_FILENAME}       <strong>!-d</strong>
1160RewriteRule ^/home/([^/]+)/.www/?(.*) http://<strong>www2</strong>.quux-corp.dom/~$1/pub/$2 [<strong>P</strong>]
1161</pre></div>
1162        </dd>
1163      </dl>
1164
1165    
1166
1167    <h3>�ε�뷱�� (���� �л��ϱ�)</h3>
1168
1169      
1170
1171      <dl>
1172        <dt>��Ȳ����:</dt>
1173
1174        <dd>
1175          <p><code>www.foo.com</code>�� ��ŷ���
1176          <code>www[0-5].foo.com</code> (�� ���� 6��)���� �л��ϰ�
1177          �ʹ�. ��� �ϴ°�?</p>
1178        </dd>
1179
1180        <dt>�ذ�å:</dt>
1181
1182        <dd>
1183          <p>�ſ� �پ��� ������� �� ������ �ذ��� �� �ִ�.
1184          ���� DNS�� ����� �� �˷��� ����� �����ϰ�,
1185          <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� ����ϴ� ��츦 ���캸��:</p>
1186
1187          <ol>
1188            <li>
1189              <strong>DNS Round-Robin</strong>
1190
1191              <p>���� ������ �ε�뷱�� ����� <code>BIND</code>��
1192              DNS round-robin ����� ����ϴ� ���̴�. ������
1193              ���� DNS A(address) ���ڵ忡
1194              <code>www[0-9].foo.com</code>�� �����Ѵ�.</p>
1195
1196<div class="example"><pre>
1197www0   IN  A       1.2.3.1
1198www1   IN  A       1.2.3.2
1199www2   IN  A       1.2.3.3
1200www3   IN  A       1.2.3.4
1201www4   IN  A       1.2.3.5
1202www5   IN  A       1.2.3.6
1203</pre></div>
1204
1205              <p>�׸��� ���� �׸��� �߰��Ѵ�:</p>
1206
1207<div class="example"><pre>
1208www    IN  CNAME   www0.foo.com.
1209       IN  CNAME   www1.foo.com.
1210       IN  CNAME   www2.foo.com.
1211       IN  CNAME   www3.foo.com.
1212       IN  CNAME   www4.foo.com.
1213       IN  CNAME   www5.foo.com.
1214       IN  CNAME   www6.foo.com.
1215</pre></div>
1216
1217              <p>�߸�� ��ó�� ��������, ������ <code>BIND</code>��
1218              �ǵ��� ����̴�. ���� <code>www.foo.com</code>��
1219              ã����, <code>BIND</code>�� �Ź� �� ���ݾ�
1220              �ٲ㰡�� <code>www0-www6</code>�� ��ȯ�Ѵ�. �׷���
1221              Ŭ���̾�Ʈ���� ���� ������ �л��Ѵ�. �׷��� DNS
1222              �˻� ��� ��Ʈ���� �ٸ� ���Ӽ����� ij���ǿ�
1223              <code>www.foo.com</code>�� ã�� ��� Ư��
1224              <code>wwwN.foo.com</code>�̸� Ŭ���̾�Ʈ�� ����
1225              ��û�鵵 ���� <code>wwwN.foo.com</code>����
1226              �������⶧���� �Ϻ��� �ε�뷱�� ����� �ƴ���
1227              �����϶�. �׷��� ũ�� ���� ��û�� ���� ��������
1228              �л�ǹǷ� ȿ�� ����.</p>
1229            </li>
1230
1231            <li>
1232              <strong>DNS �ε�뷱��</strong>
1233
1234              <p><a href="http://www.stanford.edu/~schemers/docs/lbnamed/lbnamed.html">http://www.stanford.edu/~schemers/docs/lbnamed/lbnamed.html</a>��
1235              �ִ� <code>lbnamed</code> ���α׷��� ����Ͽ�
1236              ������ DNS��� �ε�뷱���� �� �� �ִ�. DNS��
1237              ���� �ε�뷱���� �ϵ��� ����� ���� ������ Perl
1238              5 ���α׷��̴�.</p>
1239            </li>
1240
1241            <li>
1242              <strong>Proxy Throughput Round-Robin</strong>
1243
1244              <p>�� ����� <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� proxy
1245              throughput ����� ����Ѵ�. ���� DNS�� ���� �׸���
1246              ����Ͽ� <code>www0.foo.com</code>�� ����
1247              <code>www.foo.com</code>�� ����ϰ� �Ѵ�</p>
1248
1249<div class="example"><pre>
1250www    IN  CNAME   www0.foo.com.
1251</pre></div>
1252
1253              <p>�׸��� <code>www0.foo.com</code>�� ���Ͻ����
1254              ������ �����Ѵ�. ��, URL�� ������ ������ ����
1255              ���Ͻø� ���� �ٸ� 5�� ������ (<code>www1-www5</code>)
1256              �Ѵ�� �����⸸ �Ѵ�. �̸� ���� ���� ��� URL��
1257              �ε�뷱�� ��ũ��Ʈ <code>lb.pl</code>�� ������
1258              ��Ģ�� �����.</p>
1259
1260<div class="example"><pre>
1261RewriteEngine on
1262RewriteMap    lb      prg:/path/to/lb.pl
1263RewriteRule   ^/(.+)$ ${lb:$1}           [P,L]
1264</pre></div>
1265
1266              <p><code>lb.pl</code>�� �ۼ��Ѵ�:</p>
1267
1268<div class="example"><pre>
1269#!/path/to/perl
1270##
1271##  lb.pl -- �ε�뷱�� ��ũ��Ʈ
1272##
1273
1274$| = 1;
1275
1276$name   = "www";     # �⺻ ȣ��Ʈ��
1277$first  = 1;         # ù��° ���� (�ڽ��� 0�̱� ������, 0�� ������� �ʴ´�)
1278$last   = 5;         # round-robin���� ������ ����
1279$domain = "foo.dom"; # �����θ�
1280
1281$cnt = 0;
1282while (&lt;STDIN&gt;) {
1283    $cnt = (($cnt+1) % ($last+1-$first));
1284    $server = sprintf("%s%d.%s", $name, $cnt+$first, $domain);
1285    print "http://$server/$_";
1286}
1287
1288##EOF##
1289</pre></div>
1290
1291              <div class="note">������ ����: �� �� ����� �����Ѱ�?
1292              <code>www0.foo.com</code>�� �δ��� �����ʴ°�?
1293              ����, �δ��� �ȴ�. �׷��� �ܼ��� proxy throughput
1294              ��û�� �ϱ⶧���� �����! ��� SSI, CGI, ePerl
1295              ���� �������� �ٸ� ������ ó���Ѵ�. �̰��� �ٽ��̴�.</div>
1296            </li>
1297
1298            <li>
1299              <strong>�ϵ����/TCP Round-Robin</strong>
1300
1301              <p>�ϵ��� ����� �ذ�å�� �ִ�. Cisco�� TCP/IP
1302              ���ؿ��� �ε�뷱���� �ϴ� LocalDirector��� ������
1303              �Ǵ�. �����δ� �������� �մܿ� ��ġ�ϴ� ������
1304              ȸ�μ��� ����Ʈ���̴�. �ڱ��� ����ϰ� ����
1305              �ذ�å�� �ʿ��ϴٸ� �̰��� ����϶�.</p>
1306            </li>
1307          </ol>
1308        </dd>
1309      </dl>
1310
1311    
1312
1313    <h3>���ο� MIME-type, ���ο� ����</h3>
1314
1315      
1316
1317      <dl>
1318        <dt>��Ȳ����:</dt>
1319
1320        <dd>
1321          <p>��Ʈ������ ���� CGI ���α׷����� ����. �׷��� ����ϱ�
1322          ��ŷ����� ���� �����ڰ� ������� �ʴ´�. ����ġ��
1323          MIME-type�� �� Action �ڵ鷯 ��ɵ� CGI ���α׷���
1324          Ư���� URL�� (��Ȯ�� <code>PATH_INFO</code>��
1325          <code>QUERY_STRINGS</code>) ���α׷��� �Է����� �������
1326          ���� ���� �����ϴ�. ����, Ȯ���ڰ� (secure CGI�� �ٿ�)
1327          <code>.scgi</code>�� ������ ������ <code>cgiwrap</code>
1328          ���α׷����� ó���ϱ����� ���ο� type�� �����Ѵ�.
1329          ������ (������ ��) �ϰ�� URL ������ ����ϴ� ���
1330          ����� Ȩ���丮�� <code>/u/user/foo/bar.scgi</code>����
1331          URL�� ���̴�. <code>cgiwrap</code>��
1332          <code>/~user/foo/bar.scgi/</code> ����� URL��
1333          ���ϱ⶧���̴�. ���� ��Ģ�� ������ �ذ��Ѵ�:</p>
1334
1335<div class="example"><pre>
1336RewriteRule ^/[uge]/<strong>([^/]+)</strong>/\.www/(.+)\.scgi(.*) ...
1337... /internal/cgi/user/cgiwrap/~<strong>$1</strong>/$2.scgi$3  [NS,<strong>T=application/x-http-cgi</strong>]
1338</pre></div>
1339
1340          <p>���� �ٸ� ���� ���α׷�, (URL ����Ʈ���� ����
1341          <code>access.log</code>�� ����ϴ�) <code>wwwlog</code>��
1342          (URL ����Ʈ���� Glimpse�� �����ϴ�) <code>wwwidx</code>��
1343          �ִٰ� ��������. �츮�� ���α׷����� �۾��� �����
1344          URL ������ �˷���� �Ѵ�. �׷��� ��û�Ҷ����� �׻�
1345          ������ �ϱ⶧���� ������� �ʴ�. ��, ����
1346          <code>/u/user/foo/</code>�� ���� <code>swwidx</code>
1347          ���α׷��� �����Ѵٸ� ������ ���� ��ũ�� ����Ѵ�</p>
1348
1349<div class="example"><pre>
1350/internal/cgi/user/swwidx?i=/u/user/foo/
1351</pre></div>
1352
1353          <p>������� �ʴ�. ��ũ�� ������ ��ġ<strong>��</strong>
1354          CGI ��ġ�� <strong>���</strong> ���� �ϱ⶧���̴�.
1355          ������ �籸���Ѵٸ� ���� �����۸�ũ�� �����ϴµ� ����
1356          �ð��� �ɸ� ���̴�.</p>
1357        </dd>
1358
1359        <dt>�ذ�å:</dt>
1360
1361        <dd>
1362          <p>�ذ�å�� �ڵ����� ������ CGI�� �����ϴ� ���ο�
1363          Ư���� URL ����� ����� ���̴�. ������ ���� �����Ѵ�:</p>
1364
1365<div class="example"><pre>
1366RewriteRule   ^/([uge])/([^/]+)(/?.*)/\*  /internal/cgi/user/wwwidx?i=/$1/$2$3/
1367RewriteRule   ^/([uge])/([^/]+)(/?.*):log /internal/cgi/user/wwwlog?f=/$1/$2$3
1368</pre></div>
1369
1370          <p>���� <code>/u/user/foo/</code>�� �˻��ϴ� ��ũ��
1371          ������ ����</p>
1372
1373<div class="example"><pre>
1374HREF="*"
1375/u/user/foo/* (???)
1376</pre></div>
1377
1378          <p>���������� ������ ���� �ڵ���ȯ�ȴ�</p>
1379
1380<div class="example"><pre>
1381/internal/cgi/user/wwwidx?i=/u/user/foo/
1382</pre></div>
1383
1384          <p>���� ������� ��ũ �ڿ� <code>:log</code>�� ����Ͽ�
1385          ���� �α� CGI ���α׷��� ������ �� �ִ�.</p>
1386        </dd>
1387      </dl>
1388
1389    
1390
1391    <h3>���� ��������</h3>
1392
1393      
1394
1395      <dl>
1396        <dt>��Ȳ����:</dt>
1397
1398        <dd>
1399          <p>��� ������� ����ڰ� ���� �ڿ������� ����
1400          ������ <code>foo.html</code>�� ������ <code>foo.cgi</code>��
1401          ������ �� �ֳ�.</p>
1402        </dd>
1403
1404        <dt>�ذ�å:</dt>
1405
1406        <dd>
1407          <p>URL�� CGI ��ũ��Ʈ�� ���ۼ��ϰ�, MIME-type�� �����Ͽ�
1408          CGI ��ũ��Ʈ�� �����ϰ� �Ѵ�. �׷���
1409          <code>/~quux/foo.html</code>�� ��û�ϸ� ����������
1410          <code>/~quux/foo.cgi</code>�� �����ϰ� �ȴ�.</p>
1411
1412<div class="example"><pre>
1413RewriteEngine  on
1414RewriteBase    /~quux/
1415RewriteRule    ^foo\.<strong>html</strong>$  foo.<strong>cgi</strong>  [T=<strong>application/x-httpd-cgi</strong>]
1416</pre></div>
1417        </dd>
1418      </dl>
1419
1420    
1421
1422    <h3>�N ������ ���</h3>
1423
1424      
1425
1426      <dl>
1427        <dt>��Ȳ����:</dt>
1428
1429        <dd>
1430          <p>�� ����� �Ƿ� ����̴�: �������� �������� ��������,
1431          �������� �������� �����Ѵ�. ��, �������� ����ϰ�
1432          (���Ͻý��ۿ��� ���� ������ �״��) ���� ��������
1433          ��޵�����, ���� ��� �������� �������� ���Ѵ�.
1434          �׷��� ���� (Ȥ�� cron �۾���) ���� �������� �������ʴ�
1435          �� CGI�� ���� �������� �������� �����Ѵ�. ��������
1436          ����� ������ �����Ѵ�.</p>
1437        </dd>
1438
1439        <dt>�ذ�å:</dt>
1440
1441        <dd>
1442          ���� ��Ģ�� ����Ѵ�:
1443
1444<div class="example"><pre>
1445RewriteCond %{REQUEST_FILENAME}   <strong>!-s</strong>
1446RewriteRule ^page\.<strong>html</strong>$          page.<strong>cgi</strong>   [T=application/x-httpd-cgi,L]
1447</pre></div>
1448
1449          <p>���⼭ <code>page.html</code>�� ��û�Ҷ�
1450          <code>page.html</code>�� ��ų� ����ũ�Ⱑ 0�� ���
1451          ���������� <code>page.cgi</code>�� �����Ѵ�. ���⼭
1452          ����� <code>page.cgi</code>�� �Ϲ����� CGI ��ũ��Ʈ��
1453          ���� <code>STDOUT</code>�� ����ϰ�, �߰��� �����
1454          <code>page.html</code> ���Ͽ� ��´�. �ѹ� ��������
1455          ������ <code>page.html</code>�� ������ ������. �����ڰ�
1456          ����� ������ �����ϰ� �ʹٸ�, (���� cron �۾���)
1457          <code>page.html</code>�� ����⸸ �ϸ� �ȴ�.</p>
1458        </dd>
1459      </dl>
1460
1461    
1462
1463    <h3>�ڵ����� ���� ��ħ�ϴ� ����</h3>
1464
1465      
1466
1467      <dl>
1468        <dt>��Ȳ����:</dt>
1469
1470        <dd>
1471          <p>������ ���������� ���鶧 �����ڰ� ������ ������
1472          ������ �ڵ����� �������� ���� ��ħ�ϴ� ��������
1473          ������ ���� ������? �Ұ����Ѱ�?</p>
1474        </dd>
1475
1476        <dt>�ذ�å:</dt>
1477
1478        <dd>
1479          <p>�����ϴ�! MIME multipart ��ɰ� ������ NPH ���,
1480          <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�� URL ���� �ɷ��� �����ϸ�
1481          �ȴ�. ����, ���ο� URL ����� �����: URL��
1482          <code>:refresh</code>�� �߰��ϱ⸸ �ϸ� ���Ͻý��ۿ���
1483          ������ ������ ���� ��ħ�Ѵ�.</p>
1484
1485<div class="example"><pre>
1486RewriteRule   ^(/[uge]/[^/]+/?.*):refresh  /internal/cgi/apache/nph-refresh?f=$1
1487</pre></div>
1488
1489          <p>���� ���� URL�� �����ϸ�</p>
1490
1491<div class="example"><pre>
1492/u/foo/bar/page.html:refresh
1493</pre></div>
1494
1495          <p>���� URL�� ���������� ���</p>
1496
1497<div class="example"><pre>
1498/internal/cgi/apache/nph-refresh?f=/u/foo/bar/page.html
1499</pre></div>
1500
1501          <p>���� NPH-CGI ��ũ��Ʈ�� ���Ҵ�. ���� "���ڿ���
1502          �������� ���ܵ�"�̶�� �������� ;-) ���� �̰͵� �����Ѵ�.</p>
1503
1504<div class="example"><pre>
1505#!/sw/bin/perl
1506##
1507##  nph-refresh -- NPH/CGI script for auto refreshing pages
1508##  Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved.
1509##
1510$| = 1;
1511
1512#   split the QUERY_STRING variable
1513@pairs = split(/&amp;/, $ENV{'QUERY_STRING'});
1514foreach $pair (@pairs) {
1515    ($name, $value) = split(/=/, $pair);
1516    $name =~ tr/A-Z/a-z/;
1517    $name = 'QS_' . $name;
1518    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
1519    eval "\$$name = \"$value\"";
1520}
1521$QS_s = 1 if ($QS_s eq '');
1522$QS_n = 3600 if ($QS_n eq '');
1523if ($QS_f eq '') {
1524    print "HTTP/1.0 200 OK\n";
1525    print "Content-type: text/html\n\n";
1526    print "&amp;lt;b&amp;gt;ERROR&amp;lt;/b&amp;gt;: No file given\n";
1527    exit(0);
1528}
1529if (! -f $QS_f) {
1530    print "HTTP/1.0 200 OK\n";
1531    print "Content-type: text/html\n\n";
1532    print "&amp;lt;b&amp;gt;ERROR&amp;lt;/b&amp;gt;: File $QS_f not found\n";
1533    exit(0);
1534}
1535
1536sub print_http_headers_multipart_begin {
1537    print "HTTP/1.0 200 OK\n";
1538    $bound = "ThisRandomString12345";
1539    print "Content-type: multipart/x-mixed-replace;boundary=$bound\n";
1540    &amp;print_http_headers_multipart_next;
1541}
1542
1543sub print_http_headers_multipart_next {
1544    print "\n--$bound\n";
1545}
1546
1547sub print_http_headers_multipart_end {
1548    print "\n--$bound--\n";
1549}
1550
1551sub displayhtml {
1552    local($buffer) = @_;
1553    $len = length($buffer);
1554    print "Content-type: text/html\n";
1555    print "Content-length: $len\n\n";
1556    print $buffer;
1557}
1558
1559sub readfile {
1560    local($file) = @_;
1561    local(*FP, $size, $buffer, $bytes);
1562    ($x, $x, $x, $x, $x, $x, $x, $size) = stat($file);
1563    $size = sprintf("%d", $size);
1564    open(FP, "&amp;lt;$file");
1565    $bytes = sysread(FP, $buffer, $size);
1566    close(FP);
1567    return $buffer;
1568}
1569
1570$buffer = &amp;readfile($QS_f);
1571&amp;print_http_headers_multipart_begin;
1572&amp;displayhtml($buffer);
1573
1574sub mystat {
1575    local($file) = $_[0];
1576    local($time);
1577
1578    ($x, $x, $x, $x, $x, $x, $x, $x, $x, $mtime) = stat($file);
1579    return $mtime;
1580}
1581
1582$mtimeL = &amp;mystat($QS_f);
1583$mtime = $mtime;
1584for ($n = 0; $n &amp;lt; $QS_n; $n++) {
1585    while (1) {
1586        $mtime = &amp;mystat($QS_f);
1587        if ($mtime ne $mtimeL) {
1588            $mtimeL = $mtime;
1589            sleep(2);
1590            $buffer = &amp;readfile($QS_f);
1591            &amp;print_http_headers_multipart_next;
1592            &amp;displayhtml($buffer);
1593            sleep(5);
1594            $mtimeL = &amp;mystat($QS_f);
1595            last;
1596        }
1597        sleep($QS_s);
1598    }
1599}
1600
1601&amp;print_http_headers_multipart_end;
1602
1603exit(0);
1604
1605##EOF##
1606</pre></div>
1607        </dd>
1608      </dl>
1609
1610    
1611
1612    <h3>�뷮�� ����ȣ��Ʈ</h3>
1613
1614      
1615
1616      <dl>
1617        <dt>��Ȳ����:</dt>
1618
1619        <dd>
1620          <p>����ȣ��Ʈ�� ��� �ִٸ� ����ġ�� <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
1621          ����� �� �����Ѵ�. �׷��� ����ȣ��Ʈ�� ���鰳 �ִ�
1622          ISP��� �� ����� �ּ��� �ƴϴ�.</p>
1623        </dd>
1624
1625        <dt>�ذ�å:</dt>
1626
1627        <dd>
1628          <p>�� ����� �����Ϸ��� <dfn>Proxy Throughput</dfn>
1629          ����� (�÷��� <code>[P]</code>) ����Ͽ� �ܺ� ��������
1630          Ȥ�� ��ü �ܺ� �������� �츮�� �̸��� �����Ѵ�:</p>
1631
1632<div class="example"><pre>
1633##
1634##  vhost.map
1635##
1636www.vhost1.dom:80  /path/to/docroot/vhost1
1637www.vhost2.dom:80  /path/to/docroot/vhost2
1638     :
1639www.vhostN.dom:80  /path/to/docroot/vhostN
1640</pre></div>
1641
1642<div class="example"><pre>
1643##
1644##  httpd.conf
1645##
1646    :
1647#   �����̷�Ʈ�Ҷ� ���� ȣ��Ʈ���� ����Ѵ�.
1648UseCanonicalName on
1649
1650    :
1651#   ����ȣ��Ʈ�� CLF ��� �տ� �߰��Ѵ�
1652CustomLog  /path/to/access_log  "%{VHOST}e %h %l %u %t \"%r\" %&gt;s %b"
1653    :
1654
1655#   �ּ������� ���ۼ� ������ ����Ѵ�
1656RewriteEngine on
1657
1658#   �� ���� �����Ѵ�: �ϳ��� URL�� ��ġ��,
1659#   �ٸ� �ϳ��� ����ȣ��Ʈ�� DocumentRoot��
1660#   �����Ѵ�.
1661RewriteMap    lowercase    int:tolower
1662RewriteMap    vhost        txt:/path/to/vhost.map
1663
1664#   ���� ũ�� ������ ��Ģ �Ѱ��� ����Ͽ�
1665#   ����ȣ��Ʈ�� �����Ѵ�.
1666#
1667#   1. ����ȣ��Ʈ���� ���� ����ϴ� ��ġ�� �������� �ʴ´�
1668RewriteCond   %{REQUEST_URL}  !^/commonurl1/.*
1669RewriteCond   %{REQUEST_URL}  !^/commonurl2/.*
1670    :
1671RewriteCond   %{REQUEST_URL}  !^/commonurlN/.*
1672#
1673#   2. �츮�� ���� ����ϴ� ����� Host �����
1674#      ����ȣ��Ʈ�� �����ϹǷ�
1675#      Host ����� �ִ��� Ȯ���Ѵ�
1676RewriteCond   %{HTTP_HOST}  !^$
1677#
1678#   3. ȣ��Ʈ���� �ҹ��ڷ� �����
1679RewriteCond   ${lowercase:%{HTTP_HOST}|NONE}  ^(.+)$
1680#
1681#   4. vhost.map���� ȣ��Ʈ���� ã��
1682#      ����϶��� ����Ѵ�
1683#      (������ "NONE"�� �ƴϴ�)
1684RewriteCond   ${vhost:%1}  ^(/.*)$
1685#
1686#   5. ���������� URL�� ���� ��ġ�� �����ϰ�
1687#      �α׿� ��������� ����ȣ��Ʈ�� ����� �д�
1688RewriteRule   ^/(.*)$   %1/$1  [E=VHOST:${lowercase:%{HTTP_HOST}}]
1689    :
1690</pre></div>
1691        </dd>
1692      </dl>
1693
1694    
1695
1696  </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
1697<div class="section">
1698<h2><a name="access" id="access">���� ����</a></h2>
1699
1700    
1701
1702    <h3>�κ� ����</h3>
1703
1704      
1705
1706      <dl>
1707        <dt>��Ȳ����:</dt>
1708
1709        <dd>
1710          <p>��� �ϸ� Ư�� ������ �������� �ܾ������ ������
1711          �κ��� ���� �� �ֳ�? "Robot Exclusion Protocol" �׸���
1712          ������ <code>/robots.txt</code> ������ ���� �̷� �κ���
1713          ���µ� ������� �ʴ�.</p>
1714        </dd>
1715
1716        <dt>�ذ�å:</dt>
1717
1718        <dd>
1719          <p>(�Ƹ��� ���丮�� �� �κ��� ���ƴٴϸ� ������
1720          �δ��� ū ���) ���� <code>/~quux/foo/arc/</code>��
1721          �ִ� URL���� �ź��ϴ� ��Ģ�� ����Ѵ�. �츮�� Ư��
1722          �κ��� ������ ���ƾ� �Ѵ�. ��, �κ��� �����ϴ� ȣ��Ʈ��
1723          ���� �����δ� ������ϸ�, �� ȣ��Ʈ�� ����ڵ� ���ƹ�����
1724          �ȴ�. User-Agent HTTP ��� ������ ���Ѵ�.</p>
1725
1726<div class="example"><pre>
1727RewriteCond %{HTTP_USER_AGENT}   ^<strong>NameOfBadRobot</strong>.*
1728RewriteCond %{REMOTE_ADDR}       ^<strong>123\.45\.67\.[8-9]</strong>$
1729RewriteRule ^<strong>/~quux/foo/arc/</strong>.+   -   [<strong>F</strong>]
1730</pre></div>
1731        </dd>
1732      </dl>
1733
1734    
1735
1736    <h3>�׸� �۰��� ����</h3>
1737
1738      
1739
1740      <dl>
1741        <dt>��Ȳ����:</dt>
1742
1743        <dd>
1744          <p><code>http://www.quux-corp.de/~quux/</code>�� �ִ�
1745          ���������� GIF �׸��� �����Ѵٰ� ��������. �� �׸���
1746          ���־, �ٸ� ������� �ڽ��� �������� ���� ��ũ��
1747          �Ǵ�. ������ ���ʿ��� �δ��� �ǹǷ� ���� �ʹ�.</p>
1748        </dd>
1749
1750        <dt>�ذ�å:</dt>
1751
1752        <dd>
1753          <p>�׸��� 100% ��ȣ�� ���� ������, �ּ��� ������
1754          HTTP Referer ����� ������ ��� ������ �� �ִ�.</p>
1755
1756<div class="example"><pre>
1757RewriteCond %{HTTP_REFERER} <strong>!^$</strong>
1758RewriteCond %{HTTP_REFERER} !^http://www.quux-corp.de/~quux/.*$ [NC]
1759RewriteRule <strong>.*\.gif$</strong>        -                                    [F]
1760</pre></div>
1761
1762<div class="example"><pre>
1763RewriteCond %{HTTP_REFERER}         !^$
1764RewriteCond %{HTTP_REFERER}         !.*/foo-with-gif\.html$
1765RewriteRule <strong>^inlined-in-foo\.gif$</strong>   -                        [F]
1766</pre></div>
1767        </dd>
1768      </dl>
1769
1770    
1771
1772    <h3>ȣ��Ʈ �ź�</h3>
1773
1774      
1775
1776      <dl>
1777        <dt>��Ȳ����:</dt>
1778
1779        <dd>
1780          <p>��� �ܺο��� ������ ������ �� ��� ȣ��Ʈ �����
1781          ������ �� �ֳ�?</p>
1782        </dd>
1783
1784        <dt>�ذ�å:</dt>
1785
1786        <dd>
1787          <p>����ġ &gt;= 1.3b6����:</p>
1788
1789<div class="example"><pre>
1790RewriteEngine on
1791RewriteMap    hosts-deny  txt:/path/to/hosts.deny
1792RewriteCond   ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR]
1793RewriteCond   ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND
1794RewriteRule   ^/.*  -  [F]
1795</pre></div>
1796
1797          <p>����ġ &lt;= 1.3b6����:</p>
1798
1799<div class="example"><pre>
1800RewriteEngine on
1801RewriteMap    hosts-deny  txt:/path/to/hosts.deny
1802RewriteRule   ^/(.*)$ ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}/$1
1803RewriteRule   !^NOT-FOUND/.* - [F]
1804RewriteRule   ^NOT-FOUND/(.*)$ ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}/$1
1805RewriteRule   !^NOT-FOUND/.* - [F]
1806RewriteRule   ^NOT-FOUND/(.*)$ /$1
1807</pre></div>
1808
1809<div class="example"><pre>
1810##
1811##  hosts.deny
1812##
1813##  ����! �̰��� ���ó�� �������� ����� �ƴ϶� ���̴�.
1814##        mod_rewrite�� �� ������ Ű/�� ������ �ؼ��ϱ⶧����,
1815##        �� �׸��� �� �ڸ��� �ּ��� "-"�� �ʿ��ϴ�.
1816##
1817
1818193.102.180.41 -
1819bsdti1.sdm.de  -
1820192.76.162.40  -
1821</pre></div>
1822        </dd>
1823      </dl>
1824
1825    
1826
1827    <h3>���Ͻ� �ź�</h3>
1828
1829      
1830
1831      <dl>
1832        <dt>��Ȳ����:</dt>
1833
1834        <dd>
1835          <p>��� Ư�� ȣ��Ʈ Ȥ�� Ư�� ȣ��Ʈ�� ����ڰ�
1836          ����ġ ���Ͻø� ����� �� ��� �ϳ�?</p>
1837        </dd>
1838
1839        <dt>�ذ�å:</dt>
1840
1841        <dd>
1842          <p>���� ����ġ �������� �������Ҷ� �������Ͽ���
1843          <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>
1844          �Ʒ���(!) �־�� �Ѵ�. �׷��� <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>��
1845          <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code> <em>����</em> �Ҹ���.
1846          ���� ������ ���� Ư�� ȣ��Ʈ�� �ź��ϵ��� �����Ѵ�...</p>
1847
1848<div class="example"><pre>
1849RewriteCond %{REMOTE_HOST} <strong>^badhost\.mydomain\.com$</strong>
1850RewriteRule !^http://[^/.]\.mydomain.com.*  - [F]
1851</pre></div>
1852
1853          <p>...�׸��� ������ user@host�� ��� �ź��Ѵ�:</p>
1854
1855<div class="example"><pre>
1856RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST}  <strong>^badguy@badhost\.mydomain\.com$</strong>
1857RewriteRule !^http://[^/.]\.mydomain.com.*  - [F]
1858</pre></div>
1859        </dd>
1860      </dl>
1861
1862    
1863
1864    <h3>Ư���� ���� ���</h3>
1865
1866      
1867
1868      <dl>
1869        <dt>��Ȱ����:</dt>
1870
1871        <dd>
1872          <p>���� �ſ� Ư���� ������ �ʿ��� ���� �ִ�. ����
1873          ���, �̸� �����ص� ��������� �˻��Ѵ�. �̵鿡�Ը�
1874          (<code class="module"><a href="/mod/mod_auth_basic.html">mod_auth_basic</a></code>�� Basic Auth�� �����
1875          ���� �޸�) ���ٸ� �������� ������ ����Ѵ�.</p>
1876        </dd>
1877
1878        <dt>�ذ�å:</dt>
1879
1880        <dd>
1881          <p>ģ���� ������ �����ϵ��� ���ۼ� ��Ģ���� ����Ѵ�:</p>
1882
1883<div class="example"><pre>
1884RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <strong>!^friend1@client1.quux-corp\.com$</strong>
1885RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <strong>!^friend2</strong>@client2.quux-corp\.com$
1886RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} <strong>!^friend3</strong>@client3.quux-corp\.com$
1887RewriteRule ^/~quux/only-for-friends/      -                                 [F]
1888</pre></div>
1889        </dd>
1890      </dl>
1891
1892    
1893
1894    <h3>Referer��� ��ȯ��(deflector)</h3>
1895
1896      
1897
1898      <dl>
1899        <dt>��Ȳ����:</dt>
1900
1901        <dd>
1902          <p>"Referer" HTTP ����� ��� ���ϴ´�� ������������
1903          ������ �� �ִ� ������ URL ��ȯ�⸦ ���� �� �ִ°�?</p>
1904        </dd>
1905
1906        <dt>�ذ�å:</dt>
1907
1908        <dd>
1909          <p>������ ���� ������ ��Ģ��...</p>
1910
1911<div class="example"><pre>
1912RewriteMap  deflector txt:/path/to/deflector.map
1913
1914RewriteCond %{HTTP_REFERER} !=""
1915RewriteCond ${deflector:%{HTTP_REFERER}} ^-$
1916RewriteRule ^.* %{HTTP_REFERER} [R,L]
1917
1918RewriteCond %{HTTP_REFERER} !=""
1919RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND
1920RewriteRule ^.* ${deflector:%{HTTP_REFERER}} [R,L]
1921</pre></div>
1922
1923          <p>... ���ۼ� �ʰ� ���� ����Ѵ�:</p>
1924
1925<div class="example"><pre>
1926##
1927##  deflector.map
1928##
1929
1930http://www.badguys.com/bad/index.html    -
1931http://www.badguys.com/bad/index2.html   -
1932http://www.badguys.com/bad/index3.html   http://somewhere.com/
1933</pre></div>
1934
1935          <p>�׷��� ��û�� �ڵ����� (�ʿ��� ������ "<code>-</code>"��
1936          ����� ���) ������������ (URL�� �ʿ� �ִ� ��� �ι�°
1937          �ƱԸ�Ʈ��) Ư�� URL�� �����̷����Ѵ�.</p>
1938        </dd>
1939      </dl>
1940
1941    
1942
1943  </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
1944<div class="section">
1945<h2><a name="other" id="other">��Ÿ</a></h2>
1946
1947    
1948
1949    <h3>�ܺ� ���ۼ� ����</h3>
1950
1951      
1952
1953      <dl>
1954        <dt>��Ȳ����:</dt>
1955
1956        <dd>
1957          <p>FAQ: ��� �̷��� ����� ������ Ǯ �� �ִ°�?
1958          <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>�δ� �ذ�å�� �Ⱥ��δ�...</p>
1959        </dd>
1960
1961        <dt>�ذ�å:</dt>
1962
1963        <dd>
1964          <p>�ܺ� <code class="directive"><a href="/mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>�� ����϶�.
1965          ��, ���α׷��� <code class="directive"><a href="/mod/mod_rewrite.html#rewritemap">RewriteMap</a></code> ������
1966          �Ѵ�. ���α׷��� ����ġ�� �����Ҷ� �����Ͽ�
1967          <code>STDIN</code>���� ��û�� URL�� �ް�, (���� ���!)
1968          ��� (���� ���ۼ���) URL�� <code>STDOUT</code>�� ����Ѵ�.</p>
1969
1970<div class="example"><pre>
1971RewriteEngine on
1972RewriteMap    quux-map       <strong>prg:</strong>/path/to/map.quux.pl
1973RewriteRule   ^/~quux/(.*)$  /~quux/<strong>${quux-map:$1}</strong>
1974</pre></div>
1975
1976<div class="example"><pre>
1977#!/path/to/perl
1978
1979#   ����ġ ������ ������ �ʵ���
1980#   ����� ���۸� ������� �ʴ´�
1981$| = 1;
1982
1983#   stdin���� ���پ� URL�� �а�
1984#   stdout�� ��ȯ�� URL�� ����Ѵ�
1985while (&lt;&gt;) {
1986    s|^foo/|bar/|;
1987    print $_;
1988}
1989</pre></div>
1990
1991          <p>�����ϱ����� ��� <code>/~quux/foo/...</code> URL��
1992          <code>/~quux/bar/...</code>�� ���ۼ��ϴ� ��ũ��Ʈ��
1993          ���� ����. ������ ������� ���α׷����� �� �ִ�.
1994          �׷��� �Ϲ� ����ڰ� �̷� ���� <strong>�����</strong>
1995          �� �ִٰ� �ϴ����, ���� �ý��� ���ڸ��� ����
1996          <strong>�����ؾ�</strong> ���� �����϶�.</p>
1997        </dd>
1998      </dl>
1999
2000    
2001
2002  </div></div>
2003<div class="bottomlang">
2004<p><span>������ ���: </span><a href="/en/misc/rewriteguide.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
2005<a href="/ko/misc/rewriteguide.html" title="Korean">&nbsp;ko&nbsp;</a></p>
2006</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
2007<script type="text/javascript"><!--//--><![CDATA[//><!--
2008var comments_shortname = 'httpd';
2009var comments_identifier = 'http://httpd.apache.org/docs/2.2/misc/rewriteguide.html';
2010(function(w, d) {
2011    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
2012        d.write('<div id="comments_thread"><\/div>');
2013        var s = d.createElement('script');
2014        s.type = 'text/javascript';
2015        s.async = true;
2016        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
2017        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
2018    }
2019    else { 
2020        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
2021    }
2022})(window, document);
2023//--><!]]></script></div><div id="footer">
2024<p class="apache">Copyright 2013 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>
2025<p class="menu"><a href="/mod/">���</a> | <a href="/mod/directives.html">���þ��</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">���</a> | <a href="/sitemap.html">����Ʈ��</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
2026if (typeof(prettyPrint) !== 'undefined') {
2027    prettyPrint();
2028}
2029//--><!]]></script>
2030</body></html>