Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ
îðèãèíàëüíîãî äîêóìåíòà
: http://www.arcetri.astro.it/manual/ko/misc/rewriteguide.html
Äàòà èçìåíåíèÿ: Mon Jan 21 19:44:30 2013 Äàòà èíäåêñèðîâàíèÿ: Fri Feb 28 07:47:32 2014 Êîäèðîâêà: ISO8859-5 Ïîèñêîâûå ñëîâà: ï ð ï ï ð ï ð ï ð ï ð ï ð ï ð ï ð ï ï ð ï ï ð ï ï ð ï ï ð ï ï ð ï ï ð ï ï ð ï ï ð ï |
Apache HTTP Server Version 2.2
Ï?Ð?Ðê
Ralf S. Engelschall <rse@apache.org>
1997Ãò 12Ï?
ÐÜ É?Ì-ÄÒ mod_rewrite
Ò?ÑÆ É?Ì-È? ÊÈÓö×áÄé.
ÐÜ É?Ì-ÄÒ Ð?À?È?ÐêÀÅ Í×Ñ? ÐëÎ?ÏÅÌ- ÊÞÅ?ÔÅÀäÅ×ÄÒ Ð?×?Ð?ÐÞ
URLÀ?ÇÓ É?Ñ?È? ×èÀñ×ßÁòÐ?×èÌ- ÎþÆËÀä ÎÖÖÔÔÅ
mod_rewrite
È? Ë÷Ïû×ßÄÒÑ? ÌÃÈý×áÄé. URL
Ð÷ÐëÌÊ ÁäÔ?ÐË ÌÃÑ?×ßÏ? É?Ñ?È? ×èÀñ×ßÄÒ ÉöÉÐË ÐêÌÌØ? ÌÃÈý×áÄé.
mod_rewrite
ÌâÀÃÎÖÖÔÔÅ mod_rewrite
È?ÅòÐÊ ÁÂÐõ×ßÄé.
Ñÿ, URLÐË ÑÆÐë×â Ì? ÐæÄÒ À-ÇÒ×ßÀý Í×ÇÞ Ñ?ÁÃ×á È?ÅòÐÜÄé.
Ë?Ë?×èÏäÄ? ÀÕÐ× È?Å÷ ÑÎÇ?Ð× URL ÑÆÐëÐÜ ÀÅÄÙ×ßÄé. ÁçÇ?Ã?
Áç ÄûÀÅÇÞ Ë÷Ïû×ßÁò ÊÉÐò×ßÄé. mod_rewrite
Ð×
ÓæÄû ÄìÑÅÐÊ ÓÚÊÈÐêÀÅ ÐÜ×è×ßÀý Ë÷Ïû×ßÁò ÍÁÑ? ÎÚÄéÄÒ ÑÅÐÜÄé.
ÍÙÑ?Îþ ÎÖÖÔÔÅ Ð?É?ÀÅÅÅ ÑÎÑÎ mod_rewrite
Ð×
Ë?ÇÞÏþ ÏûÅÅÈ? ÉïÀï×áÄé.
ÄéÈ? ÈËÇÞ: mod_rewrite
ÏÅ Äû×è Ä÷ÍÕÐÊ
ÓÃÐÍÏÅ ÀÜÐË ÈäÀý ÐÄûÇÞ ÄéÍÓ Ë÷Ïû×ßÑ? ÎÚÀÕÃ?, À-ÇÒ×äÏÅ ÈÕÇñÅ×Îþ
ÎåÐÈÇÞ Ëþ ÅÏÎØ Ë÷Æ?ÏÅ Ê?Ñ? ÀÝÐÜÄé. ÐÜ ÁëÐÊ ÓÉÉ?ÒÀ ÀöÏüÈ?
ÈÇÁòÐ?×è ÐÜÉÜ ÎÛÇÑÑ? ÈþÀÅÑ? ÌÊÀ?Ë÷ÇÚÈ? ÌâÀÃ×ßÇÑÀý ×áÄé.
ÐÜÑ? ÃËÀÅ Ñ?Ñ? ÈÈÅùÎ?ÀÕÃ? ÄéÈ? Ë÷Æ?ÅùÐÜ ÈÈÅ÷ ÈÉÐÊ Í×ÏûÐ?ÐÞ ×èÀñÓ?ÐÜ Ã?ÏÒÄé. ÏÉÑ?ÏÅÌ- URL Ð÷ÐëÌÊÐ× ØöÈÆÌ?ÐË ÈÆÐÍÂ? ÉøÏüÁö ÉéÆ?Äé.
mod_alias
, mod_userdir
ÅþÐË Ë÷Ïû×áÄéÈù [PT]
×ÓÇÅÁçÈ? ÓïÀÅ×áÄé. Ø?ÐÊ
ÑæÌ-É?ÌÃÑ?/ÀÅË?Ø?ÍÊÖ? Ë÷ÏûÐõÌâÀÅ ÎÖÄá .htaccess
Ë÷ÏûÐõÌâÏÅ ÎÛÈÒÀä ÁäÔ?ÐË Ì?Ñ?×â Ì?ÅÅ ÐæÄé. Ë÷Ïû×ßÁò Ð?ÏÅ
×çË? ÁäÔ?ÐÜ ÎþÆ ÁòÄÙÐË ×ßÄÒÑ? ÐÜ×è×ßÅÅÇß ×èÆ?. ÁçÇ?Èù É?Ñ?È?
×××â Ì? ÐæÄé.×á È?ÌâÍÊÏÅ Äû×è Ï?Ç? URLÐË ÀÅÑ?ÄÒ Ð?Ì-É?ÀÅ ÐæÄé. ÊÈÕû (Í×Ñ? Ë÷Ïû×ßÀý ÎÛÇÑÑ?Îï ×â) ÁòÑèÐÜ Å×ÄÒ URLÀ?, ÄìÓð Ø?ÐÊ ÃËÊÞ ÏûÅÅÐ× URLÐÜ ÐæÄé. Ë÷ÏûÐêÀÅ ÏôÓËÏÅ ÎþÆ URLÐË Ë÷Ïû×ßÄ?Ñ? ÁòÑèÐÜ Å×ÄÒ URLÈÈÐË ÊÈÏ?ÑðÎï ×áÄé.
ÁòÑèÐÜ Å×Ñ?ÎÚÄÒ È?Å÷ URLÐË ÊúÆ?ÏüÐ?ÀÅ ÎÛÅÅÇß ÀýÔÅÁòÐ?×è
ÏìÊÞ HTTP È?ÄéÐÜÇÊÌ××áÄé. ÏÉÈ? ÅùÎþ ÎÖÇÅ ÁäÔ?ÐÊ
/~user
È? ÁòÑèÐÜ Å×ÄÒ /u/user
ÇÞ
ÄûÓÌ×ßÀý, /u/user
ÈÆÑ?ÈÇÏÅ ÍÍÇÅÍ?ÀÅ Î?ÄéÈù
ÓïÀÅ×áÄé.
RewriteRule ^/~([^/]+)/?(.*) /u/$1/$2 [R] RewriteRule ^/([uge])/([^/]+)$ /$1/$2/ [R]
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]
DocumentRoot
È? ÏÕÁô ÀöÏüÐ?Ì-É?Ð× DocumentRoot
ÄÒ ÊÈÕû URL
"/
"À? Ñ?Ñ? À?ÇÓÐæÄé. ÁçÇ?Ã? ÐÜÀ?ÏÅ È?Å÷
ÐêÇñÀÅ ÐæÑ? ÎÚÀý, ÐêÇñÀÅ ÄéÈ? Ï?Ç? À?ÏÅ Ø?ÎþÑ?ÐæÄÒ
ÀöÏüÀÅ ÐæÄé. ÏÉÈ? ÅùÎþ ÐÞÖ?Æ?Ãí Ë÷ÐÜÖ?ÏÅ (ÏìÊÞÈ? Ð?×á
Ø?ÖôÐÜÑ?) /e/www/
ÏÝ (ÐÞÖ?Æ?ÃíÐË Ð?×á
Ø?ÖôÐÜÑ?) /e/sww/
ÀÅ ÐæÄéÀý ×ßÐê. ÐÜÑ?
DocumentRoot
ÀÅ
/e/www/
ÐÜÁòÆ?É?ÏÅ, ÏôÓËÏÅÌ- ÖôÐÜÑ?ÏÅ
Ö?×äÅØ ÁçÈ ÅþÐË ÐÜÀ?ÏÅÌ- ÀÅÑ?ÏÝÎï ×áÄé.
ÏüÈ?ÄÒ URL /
È? /e/www/
ÇÞ
È?ÄéÐÜÇÊÌ×ÈÈ ×ßÈù ÅØÄé. Ë÷Ìâ×è ÊÈÐÜÑ?ÈÈ Í×Ñ?ÇÞ
mod_rewrite
È? Ë÷Ïû×èÌ-ÈÈ ÀÅÄÙ×ßÄé.
(mod_alias
ÅþÐÜ Ñ?À?×ßÄÒ) URL
Alias ÀÀÐÊ Ð?×?Ð?ÐÞ ÉöÉÐÊ ÎåÊÞÊàÈÈ
Ó?ÄÒÄé. DocumentRoot
ÀÅ
È?Å÷ URLÐ× ÎåÊÞÊàÐÜÁòÆ?É?ÏÅ ÐÜ ÉöÉÐË Ë÷Ïû×ßÏ? È?ÄéÐÜÇÊÌ×ÐË
×â Ì? Î?Äé. mod_rewrite
È? Ë÷Ïû×ßÈù
Ñ?Ò? À?Äì×ßÄé:
RewriteEngine on RewriteRule ^/$ /e/www/ [R]
Å?ÇÊÕôÈ?È? Ñ?Ô?×ßÄÒ URLÐ× ÈÆÑ?ÈÇ ÍÍÇÅÍ? É?Ñ?ÀÅ
Î?ÄéÈù È?Å÷ Ð?À?È?ÐêÄÒ Ø?Ø?×â ÀÝÐÜÄé. ÍÍÇÅÍ?ÀÅ Î?ÄéÈù,
Ñÿ /~quux/foo/
ÄûÍÕ /~quux/foo
È?
Ë÷Ïû×ßÈù Ì-É?ÀÅ foo
Æ?ÄÒ ÖÔÐßÐË
Ó?ÁòÆ?É?ÏÅ ÏÐÇ?ÀÅ ÉïË×áÄé. ÖÔÐßÐÜ Å?ÇÊÕôÈ?ÐÜÁòÆ?É?ÏÅ
ÉîÎÖÅùÐÜÑ? ÎÚÄÒÄé. ÄûÊÞÊàÐ× ÀöÏü ÊÈÕû Ì-É?ÀÅ ÐêÅÏÐÈÇÞ
URLÐË ÀýÔÅÑ?ÈÈ, ÀÅÂ? Ñ?Ñ? ×èÑðÎï ×â ÀöÏüÀÅ ÐæÄé. ÏÉÈ?
ÅùÎþ, CGI ÍÊÕ?ÈÃÖ? ÅþÐÈÇÞ ÊÉÐò×á URL Ð÷ÐëÌÊÐË ×á ØÔÏÅ
ÁçÇ?×ßÄé.
ÐÜ ÉÜÉ?×á É?Ñ?Ð× ×èÀñÉöÉÐÊ Ì-É?ÀÅ ÐêÅÏÐÈÇÞ ÈÆÑ?ÈÇ
ÍÍÇÅÍ?È? ÓïÀÅ×ßÄÒ ÀÝÐÜÄé. ÊúÆ?ÏüÐ?ÀÅ Ã?ÈãÑ? ÁçÈ ÅþÐË
ÏÓÉéÇÞ ÏôÓË×â Ì? ÐæÅÅÇß, ÏìÊÞ È?ÄéÐÜÇÊÌ×ÐË ×èÎï ×áÄé.
ÃËÊÞ È?ÄéÐÜÇÊÌ×ÐË ×áÄéÈù Å?ÇÊÕôÈ? ÖôÐÜÑ?ÏÅÈÈ ÅÏÐë×ßÏ?
ÐÜ ÖôÐÜÑ?ÀÅ Ë?Äû URLÇÞ Ö?×ä×ßÄÒ ÁçÈÂÐË ÊúÆ?ÏüÐ?ÀÅ
ÏôÓË×âÆ? Ó?ÐË Ì? Î?Äé. ÏÉÈ? ÅùÎþ, ÏìÊÞ È?ÄéÐÜÇÊÌ×ÐË
Ë÷Ïû×ßÑ? ÎÚÐËÆ? /~quux/foo/index.html
ÏÅÌ-
image.gif
È? ÏôÓË×ßÈù
/~quux/image.gif
È? ÏôÓË×ßÀä ÅØÄé!
ÁçÇÅÌ- ÐÜÈ? ×èÀñ×ßÁòÐ?×è ÄéÐÍÀ? ÀÀÐÜ ÌÃÑ?×áÄé:
RewriteEngine on RewriteBase /~quux/ RewriteRule ^foo$ foo/ [R]
Ø?Å?ÇÊÕôÈ?Ð× ÓæË?Ð? .htaccess
ÖÔÐßÏÅ
ÄéÐÍÀ? ÀÀÐÜ ÌÃÑ?×â Ì?ÅÅ ÐæÄé. ÁçÇ?Ã? ÓÃÈ?×ßÄÒÅ? ÊÞÄóÐÜ
ÅØÄé.
RewriteEngine on RewriteBase /~quux/ RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+[^/])$ $1/ [R]
ÐÞÖ?Æ?Ãí Ð?Ì-É?ÁÊÐ× È?Å÷ Ð?Ì-É?ÏÅ ÅÏÐß×ßÀý ÐßÀ?ÅØ URL ÁÈÑÆÈ? ÈÈÅùÀý ÍÝÄé. Ñÿ, È?Å÷ (Ñ?Ð×Ë? Ì-É?ÏÅ Ìã×ßÏ? Ì-É?ÏÅ Ð×ÑÈÐ?ÐÞ!) URLÐË Ì-É? ÅÆÈÃÐ?ÐÈÇÞ ÈÈÅ÷Äé! Ð? ÐÜÈ?À?À?ÏÅ Ì-É?ÅÆÈÃÐ?ÐÞ ÅÏÐß×á ÁÈÑÆÈ? ÊÞÏ?×èÎï ×áÄé: URLÐÊ Í×Ñ? Ì-É?È? Ñ?Ô?×ßÈù ÎØÅØÄé. Ì-É?ÁÊÐÜ ÐêÅÏÐÈÇÞ Í×Ñ? Ì-É?ÇÞ Ð?ÅÅ×áÄé.
ÈåÐ? Ë÷ÏûÐê, ÁçÇü, ÅÆÈÃÓÌÐ× Ð?ÔÅ Ñ?ÊÈÈ? Ð?Ðõ×á (ÊàËúÅØ) ÏìÊÞÈÚÏÅ Í×Ñ? Ì-É? Ñ?ÊÈÈ? Î?ÎþÏÒÄé. ÏìÊÞÈÚÐÊ ÄéÐÍÀ? ÀÀÐÊ ×?ÍÔÐÜÄé
user1 server_of_user1 user2 server_of_user2 : :
ÏüÈ?ÄÒ ÐÜ Ñ?ÊÈÈ? À?À? map.xxx-to-host
ÖÔÐßÏÅ Ð?Ðõ×ïÄé. ÄéÐÍÐÈÇÞ È?Å÷ Ì-É?ÏÅÌ- URLÐÜ Ì-É?ÏÅ
Î?ÄéÈù ÄéÐÍÀ? ÀÀÐÊ URLÐË,
/u/user/anypath /g/group/anypath /e/entity/anypath
ÄéÐÍÀ? ÀÀÐÜ È?ÄéÐÜÇÊÌ××áÄé
http://physical-host/u/user/anypath http://physical-host/g/group/anypath http://physical-host/e/entity/anypath
ÎÖÇÅ ÁäÔ?ÐÊ ÈÚÖÔÐßÐË Ë÷Ïû×ßÏ? ÐÜ ÐëÎ?ÐË ×áÄé (server0ÐÊ ÈÚÏÅ ×çÈåÐÜ Î?ÄÒ ÀöÏü Ë÷Ïû×â ÁòÊËÌ-É?Æ?Àý ÀÅÑ?×áÄé):
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/([^/]+)/?(.*) http://${user-to-host:$1|server0}/u/$1/$2 RewriteRule ^/g/([^/]+)/?(.*) http://${group-to-host:$1|server0}/g/$1/$2 RewriteRule ^/e/([^/]+)/?(.*) http://${entity-to-host:$1|server0}/e/$1/$2 RewriteRule ^/([uge])/([^/]+)/?$ /$1/$2/.www/ RewriteRule ^/([uge])/([^/]+)/([^.]+.+) /$1/$2/.www/$3\
ÈÉÐÊ Ð?À?È?ÐêÄÒ Ð?Ì-É?Ð× È?Å÷ Ø?Å?ÇÊÕôÈ?È? ÄéÈ? Ð?Ì-É?ÇÞ ÐÜÐ?×á ÀöÏü ×èÀñÓ?ÐË ÉÀÎþÊËÄé. ÐÜ ÉöÉÐÊ ÐÜÐ? Ì-É?È? ÄûÓÌ×â Ë?ÇÞÏþ Ì-É?È? ÁÈÌÊ×ßÄÒÅ? ÍÓÀ?ÐÜ ÀÙÈ?ÄÒ ÀöÏüÏÅ ×ÚÏô×ßÄé.
mod_rewrite
È? Ë÷Ïû×ßÈù À?Äì×ßÄé.
ÐÜÐ? Ð?Ì-É?ÄÒ È?Å÷ /~user/anypath
URLÐË
http://newserver/~user/anypath
ÇÞ
È?ÄéÐÜÇÊÌ××ßÈù ÅØÄé.
RewriteEngine on RewriteRule ^/~(.+) http://newserver/~$1 [R,L]
Ë÷ÏûÐêÀÅ Ì?ÓÅÈýÐÞ Ë÷ÐÜÖ?ÄÒ ÊÈÕû Ø?Å?ÇÊÕôÈ? ÁÈÑÆÈ?
ÈÈÅ÷Äé. Ñÿ, ÏÉÈ? ÅùÎþ ÐÜÈ?ÐÜ Ë÷ÏûÐêÈýÐ× ÓÉÉ?ÒÀ É?ÐêÐÞ
×ßÐ?Å?ÇÊÕôÈ?ÏÅ Ø?Å?ÇÊÕôÈ?È? ÅàÄé. ÁçÇÅÌ-,
/~foo/anypath
ÄÒ
/home/f/foo/.www/anypath
ÐÜÀý,
/~bar/anypath
ÄÒ
/home/b/bar/.www/anypath
ÐÜÄé.
ÉÀÀñ×?ÍÓÀÅ ÐæÄÒ URLÐË Ð?ÏÝ ÀÀÐÊ ÁÈÑÆÇÞ Ê?Ø?×ßÁòÐ?×è ÄéÐÍ ÁäÔ?ÐË Ë÷Ïû×áÄé.
RewriteEngine on RewriteRule ^/~(([a-z])[a-z0-9]+)(.*) /home/$2/$1/.www$3
ÐÜ ÏÉÄÒ Í×ÇÞ ×ßÅõÔêÎþÐ?ÐÜÄé: Å?ÇÊÕôÈ?ÊÀ
RewriteRules
È? ÈÕÏü ÈÉÐÜ Ë÷Ïû×ßÏ? ÐêÇñ
ÐêÓÌÄÒ ÁçÄûÇÞ ÅàÓÌÇÞ Ð?ÏÅ ÐêÇñÈ? ÐêÏ?ÍÊÇÄÀä ÊúÆ?ÏüÒÅ×ßÅÅÇß
×áÄé. ÉøÀö: Ã?ÄÒ 1992Ãò ÊÞÕÝ ÐêÐ?ÇãÀä Ë÷Ïû×â Ì? ÐæÄÒ
Ð?ÄàÍÊ Ìâ×ÑÖ?Ï?ÎþÅùÐË net.swÏÅ
È?ÎÖÅÞÀý ÐæÎ?Äé. ÐÜÄÒ ÃËÀÅ ÔÔ×ËÕÝÀ?×àÐË À?ÊÞ×ßÈùÌ-
Ï?Ç?×èÅÏÎØ Ï?ÀÅÍÓÀ?ÏÅ ÍÓÍÊÕë À?È?ÐêÏÝ ÃçÖ?Ï? À?È?ÐêÈ?
×èÏäÁòÆ?É?ÏÅ ÃË ÓûÉÜÐÜÐê ÐßÐÜÄé. ÈÕÑæÈÆÄé Ë?ÇÞ Ìâ×ÑÖ?Ï?ÎþÀÅ
ÓïÀÅÅÙ Æ?ÈÆÄé Å?ÇÊÕôÈ?È? ÁýÀä ÈÈÅùÎþÏäÄé:
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/
1996Ãò 7Ï? ÐÜ Ð?ÐõÌâÈ? ÈêÐæÄÒ Ð? ÐÞÕÝÖôÐÜÍÊÈ? Õû×è ÌÌË?ÏÅ À?ÀÃ×ßÁòÇÞ ÀñÑ?×îÄé. "ÈêÐæÄé"ÄÒ ÈËÐÊ, ÓæË?Ð? Å?ÇÊÕôÈ?ÏÅ CGI ÍÊÕ?ÈÃÖ?È? ÅÞÑ? ÎÚÀýÅÅ, Ð?ÐõÌâ ÀøÓ?ÁÈÑÆÈ? Ñ?Ñ? ÊúÆ?ÏüÑ?×ßÁö ÉéÆ?ÄéÄÒ ÆöÐÜÄé. Ïæ? Ð?ÐõÌâÈ? Ã?ÑïÏÅ FTPÇÞÅÅ Ñ?Áé×â Ì? ÐæÅÅÇß ÈÈÅù ÏÉÑ?ÐÜÏÄÁòÆ?É?ÏÅ Ð?ÐÜÃ? CGIÏÝ À?ÇÓÅØ ÃËÏûÐË ÀÀÐÜ ÅÞÁò ÍØÎ?Äé.
×èÀñÓ?ÐÊ ÅÞ ÊÞÊàÐÈÇÞ Ã?ÄÆÄé: ÈåÐ? Å?ÇÊÕôÈ? Ì?ÑèÏÅÌ-
×ÚÏô×á È?Å÷ ÖôÐÜÑ?È? ÅÏÐ?ÐÈÇÞ ÈÈÅõÄÒ CGI ÍÊÕ?ÈÃÖ?ÀÅ
×ÚÏô×ßÄé. Ã?ÄÒ ÐÜ ÍÊÕ?ÈÃÖ?ÅùÐË ÄéÐÍÀ? ÀÀÐÜ
/e/netsw/.www/
ÏÅ ÅÞÎ?Äé:
-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
DATA/
×ßÐ?Å?ÇÊÕôÈ?ÏÅ Ð?ÏÅÌ- ÈË×á Ð?ÐõÌâÀÅ
ÐæÄé. Í×Ñ? net.swÐ× ÃËÏûÐÊ ÊÈÕû
rdist
È? Ë÷Ïû×ßÏ? ÐêÅÏÐÈÇÞ ÀÅÑ?ÏÒÄé. ÅÞÉ?ÒÀ
ÊÞÊàÐÜ ÃÂÎâÄé: ÎþÆËÀä ÐÜ ÅÞ ÁÈÑÆÈ? ×ßÃ?Ð× ÐêÏ?ÍÊÇ?Ïþ
URL ÁÈÑÆÇÞ Ï?Àñ×ßÄÒÀÅ? Ë÷ÏûÐêÏÅÀä DATA/
Å?ÇÊÕôÈ?È? À?ÓïÀý, URLÈÆÄé Ð?Ð×á CGI ÍÊÕ?ÈÃÖ?È? Í××ð×ßÀý
ÍÝÄé. ×èÀñÓ?ÐÊ ÄéÐÍÀ? ÀÀÄé: ÈåÐ? Ì-É?Ð× DocumentRoot
ÏÅÌ- À?ÀÃÅØ
URL /net.sw/
È? ÃËÊÞ ÀöÇÞ /e/netsw
ÇÞ
Ð÷ÐëÌÊ×ßÁòÐ?×è Å?ÇÊÕôÈ?ÊÀ ÌÃÑ?ÖÔÐßÏÅ ÄéÐÍÀ? ÀÀÐÜ ÌÃÑ?×áÄé:
RewriteRule ^net.sw$ net.sw/ [R] RewriteRule ^net.sw/(.*)$ e/netsw/$1
ÓÉÉ?ÒÀ ÁäÔ?ÐÊ ÈÆÑ?ÈÇÏÅ ÍÍÇÅÍ?ÀÅ Î?ÄÒ ÏôÓËÐË Ð?×èÌ-
Ë÷Ïû×ïÄé! ÅÞÉ?ÒÀ ÁäÔ?ÐÜ Í×Ñ? ÐëÎ?ÐË ×áÄé. ÁçÈ?Àý Å?ÇÊÕôÈ?ÊÀ
ÌÃÑ?ÖÔÐß /e/netsw/.www/.wwwacl
ÏÅ ÀñÑ?Ð?ÐÞ
ÌÃÑ?ÐÜ Ã?ÏÒÄé:
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
×èÌ?ÐË Ð?×á Ø?Ö?:
-
')ÀÅ
Î?Àý L
(last) ×ÓÇÅÁçÀÅ ÐæÐÍÐË ÑæÈå×ßÆ?!
(not) É?ÐêÏÝ C
(chain) ×ÓÇÅÁçÈ? ÑæÈå×ßÆ?mod_imagemap
ÐÈÇÞË÷Æ?ÅùÐÊ NCSA Ð?Ì-É?ÏÅÌ- ×?ÄûÐ?ÐÞ ÎÖÖÔÔÅ Ð?Ì-É?ÇÞ
ÐêÏ?ÍÊÇÄÀä ÏÕÀìÀÅÁö ÉéÆ?Äé. ÁçÇÅÌ- ÏÐÇÅÅØ NCSA
imagemap
×ÑÇÞÁçÇ?ÐË Ë÷Ïû×á ÖôÐÜÑ?È? ×?ÄûÐ?ÐÞ
ÎÖÖÔÔÅ mod_imagemap
ÇÞ ÓÃÈ?×ßÁö ÉéÆ?Äé.
É?Ñ?ÄÒ imagemap
×ÑÇÞÁçÇ?ÐË
/cgi-bin/imagemap/path/to/page.map
À?
ÀÀÐÜ Ò?ÑÆ×ßÄÒ ×ßÐÜÖëÈÅÕ?ÀÅ ÈÉÄéÄÒ ÀÝÐÜÄé. ÎÖÖÔÔÅÄÒ
/path/to/page.map
À? ÀÀÐÊ ÏôÓËÐË ÉîÎÖÎï
×áÄé.
È?Å÷ ÏôÓËÏÅÌ- ÎåÊÞÊàÐË ÅÏÐ?ÐÈÇÞ Ñ?ÀÕ×ßÄÒ Ð?Ï? ÁäÔ?ÐË Ë÷Ïû×áÄé:
RewriteEngine on RewriteRule ^/cgi-bin/imagemap(.*) $1 [PT]
ÀÅÂ? Ð?Ì-É?ÀÅ Ï?Ç? Å?ÇÊÕôÈ?ÏÅÌ- ÖÔÐßÐË Ó?ÎÖÎï ×â Æ?ÀÅ ÐæÄé. ÐÜ ÀöÏü MultiViewsÃ? ÄéÈ? ÉöÉÐÊ ÅÅÏ?ÐÜ ÎØÅØÄé.
Ï?Ç? Å?ÇÊÕôÈ?ÏÅÌ- ÖÔÐßÐË Ó?ÄÒ ÁäÔ?ÐË Ñ?Ñ? ×ÑÇÞÁçÇ?×áÄé.
RewriteEngine on # ÈåÐ? custom/ÏÅÌ- Ó?Áö ÍÓÅÅ×ßÀý... # ...Ó?ÐÈÈù ÃÅ! RewriteCond /your/docroot/dir1/%{REQUEST_FILENAME} -f RewriteRule ^(.+) /your/docroot/dir1/$1 [L] # ÅÞÉ?ÒÀÇÞ pub/ÏÅÌ- Ó?Áö ÍÓÅÅ×áÄé... # ...Ó?ÐÈÈù ÃÅ! RewriteCond /your/docroot/dir2/%{REQUEST_FILENAME} -f RewriteRule ^(.+) /your/docroot/dir2/$1 [L] # È?Ó?ÐÈÈù ÄéÈ? AliasÃ? ScriptAlias Ñ?ÍÓÎþ ÅþÐÈÇÞ Ñ?×ð×áÄé. RewriteRule ^(.+) - [PT]
ÏôÓËÅùÀ?ÏÅ Ë?ÕÒÑ?ÊÈÈ? Ð?Ñ?×ßÁòÐ?×è URLÏÅ Ñ?ÊÈÈ? ÐÞÔêÅ?×ßÄÒ ÉöÉÅÅ ÐæÄé. ÁçÇ?Ã? ÄìÑ? ÐÜ Ñ?ÊÈÈ? Ñ?ÀÕ×ßÁòÐ?×è È?Å÷ ÖôÐÜÑ?ÏÅ CGI wrapperÈ? Ë÷Ïû×ßÀý ÍÝÑ? ÎÚÄé.
Ð÷ÐëÌÊ ÁäÔ?ÐË Ë÷Ïû×ßÏ? Ë?ÕÒÑ?ÊÈÈ? ÓïÓò×ßÀý, ÓïÓò×á
Ñ?ÊÈÈ? Ã?ÑïÏÅ XSSIÃ? CGIÏÅÌ- Ë÷Ïû×ßÁòÐ?×è Ø?ÀöÊ?Ì?ÏÅ
Ð?Ðõ×áÄé. ÁçÇÅÌ- URL /foo/S=java/bar/
ÄÒ
/foo/bar/
ÇÞ Ê?Ø?Å×Àý STATUS
Æ?ÄÒ
Ø?ÀöÊ?Ì? À?ÐË "java"ÇÞ ÌÃÑ?×áÄé.
RewriteEngine on RewriteRule ^(.*)/S=([^/]+)/(.*) $1/$3 [E=STATUS:$2]
ÀÅË?Ø?ÍÊÖ?È? Ë÷Ïû×ßÑ? ÎÚÀý ÀÀÐÊ ÔÔ×ËÕÝÇÞ DNS A
ÇÉÔêÅõÈ? ÌÃÑ?×ßÏ?
www.username.host.domain.com
ÐË
Ë÷ÏûÐêÐ× Ø?ÖôÐÜÑ?ÇÞ Ñ?À?×ßÀý ÍÝÄé.
HTTP/1.0 ÏôÓËÐ× ÀöÏü ÉöÉÐÜ Î?Ñ?ÈÈ, Host: HTTP
×üÄ?È? Ö?×ä×á HTTP/1.1 ÏôÓËÐÊ ÄéÐÍ ÁäÔ?ÐË Ë÷Ïû×ßÏ?
ÃËÊÞÐ?ÐÈÇÞ http://www.username.host.com/anypath
È?
/home/username/anypath
ÇÞ Ð÷ÐëÌÊ×â Ì?
ÐæÄé:
RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.[^.]+\.host\.com$ RewriteRule ^(.+) %{HTTP_HOST}$1 [C] RewriteRule ^www\.([^.]+)\.host\.com(.*) /home/$1$2
Ñ?Ï? ÅÅÈîÐÞ ourdomain.com
ÉëÏÅÌ- ÏôÓËÐÜ
ÅùÎþÏÐÈù Ø?Å?ÇÊÕôÈ? URLÐË ÄéÈ? Ð?Ì-É?
www.somewhere.com
ÐÈÇÞ È?ÄéÈ?ÇÊÌ××ßÁö
ÉéÆ?Äé. ÑÎÑÎ ÀÅË?Ø?ÍÊÖ? Ë÷ÏûÐõÌâÏÅÌ- Ë÷Ïû×áÄé.
Ð÷ÐëÌÊ ÑÆÀ×ÐË Ë÷Ïû×ßÈù ÅØÄé:
RewriteEngine on RewriteCond %{REMOTE_HOST} !^.+\.ourdomain\.com$ RewriteRule ^(/~.+) http://www.somewhere.com/$1 [R,L]
URL Ð÷ÐëÌÊÏÅ Äû×èÌ- Ð?Ì-É? AÏÅ ×èÄ÷ ÖÔÐßÐÜ Î?ÄÒ
ÀöÏü Ð?Ì-É? BÇÞ ÏôÓËÐË È?ÄéÐÜÇÊÌ××ßÄÒ ÉöÉÐË ÐêÑæ
ÉÀÎþÊËÄé. ÊÈÕû PerlÇÞ ÐëÌÊ×á ErrorDocument
CGI ÍÊÕ?ÈÃÖ?È?
Ë÷Ïû×ßÑ?ÈÈ, mod_rewrite
È? Ë÷Ïû×ßÄÒ
ÉöÉÅÅ ÐæÄé. ÁçÇ?Ã? ÌÊÄÙÐÊ ErrorDocument
CGI ÍÊÕ?ÈÃÖ?ÊÈÄé
ÆÃÎþÑ?ÐË ÈýÍÙ×ßÆ?!
ÓÉÉ?ÒÀ ÉöÉÐÊ Ê?È?Ñ?ÈÈ Ð?Ï?ÌÊÐÜ ÆÃÎþÑ?Àý ÏßÐ?×ßÑ? ÎÚÄé:
RewriteEngine on RewriteCond /your/docroot/%{REQUEST_FILENAME} !-f RewriteRule ^(.+) http://webserverB.dom/$1
ÐÜ ÉöÉÐ× ÄìÑÅÐÊ DocumentRoot
ÎØÏÅ ÐæÄÒ ÖôÐÜÑ?ÈÈ
ÀÅÄÙ×ßÄéÄÒ ÑÅÐÜÄé. (ÏÉÈ? ÅùÎþ Ø?Å?ÇÊÕôÈ? ÅþÐË Ð?×è)
ÑÆÀ×ÐË ÓïÀÅ×â Ì? ÐæÑ?ÈÈ, Ä? ÑÑÐÊ ÉöÉÐÜ ÐæÄé:
RewriteEngine on RewriteCond %{REQUEST_URI} !-U RewriteRule ^(.+) http://webserverB.dom/$1
mod_rewrite
Ð× URL Ð?ÉöÒ?ÑÆ(look-ahead)È?
Ë÷Ïû×áÄé. ÁçÇÅÌ- È?Å÷ URLÏÅ ÅÏÐë×ßÀý ÎØÐ?×ßÄé. ÁçÇ?Ã?
È?Å÷ ÏôÓËÈÆÄé ÃËÊÞ ×ßÐ?ÏôÓËÐË ×áÉ? Ä? ×ßÁòÆ?É?ÏÅ Ð?Ì-É?
ÌÊÄÙÏÅ Î×ÏÅ×òÐË ÑèÄé. ÁçÇÅÌ- À-ÇÒ×á CPUÏÅÌ- Ð?Ì-É?È?
Í××ð×áÄéÈù Ë÷Ïû×ßÆ?. ÔÔ×ËÕÝÀÅ ÄÐÈ?ÄéÈù ÓÉÉ?ÒÀ ÉöÉÐÜÃ?
Ä? Ã?ÐÊ ErrorDocument
CGI ÍÊÕ?ÈÃÖ?È? Ë÷Ïû×ßÆ?.
ÀÅÂ? È?ÄéÐÜÇÊÌ××ßÄÒ URLÐË Ä? ÑÆÐ×â ×ÚÏôÀÅ ÐæÄé.
ÎÖÖÔÔÅ ÃËÊÞ URL escape ×äÌ?ÄÒ "url#anchor
"
ÀÀÐÊ URLÐ× anchorÅÅ escape×áÄé. ÎÖÖÔÔÅÐ×
uri_escape()
×äÌ?ÄÒ ÏüÉÀÑ?Ðê(#)ÅÅ ÀÀÐÜ
escape×ßÉ×ÇÞ Ë÷Ïû×â Ì? Î?Äé. ÁçÇ?Èù ÎþÆËÀä ÐÜÇÁ URLÇÞ
È?ÄéÐÜÇÊÌ××â Ì? ÐæÃ??
Ñ?Ñ? È?ÄéÐÜÇÊÌ××ßÄÒ NPH-CGI ÍÊÕ?ÈÃÖ?È? Ë÷Ïû×á ×èÀñÓ?ÐÜ
×ÚÏô×ßÄé. escapeÈ? ×ßÑ? ÎÚÁòÆ?É?ÐÜÄé (NPH=non-parseable
headers). ÈåÐ? ÄéÐÍ Ì-É?ÌÃÑ?ÐË ×ßÏ? (Ð÷ÐëÌÊ ÁäÔ?Ð×
ÃÅÊÞÊàÏÅ Ë÷Ïû×èÎï ×áÄé) Ë?ÇÞÏþ URL scheme
xredirect:
È? ÅÅÐä×áÄé:
RewriteRule ^xredirect:(.+) /path/to/nph-xredirect.cgi/$1 \ [T=application/x-httpd-cgi,L]
ÁçÇ?Èù xredirect:
ÇÞ ÍÓÐë×ßÄÒ È?Å÷ URLÐÊ
nph-xredirect.cgi
×ÑÇÞÁçÇ?ÐË Õû×ßÀä ÅØÄé.
×ÑÇÞÁçÇ?ÐÊ ÄéÐÍÀ? ÀÀÄé:
#!/path/to/perl ## ## nph-xredirect.cgi -- NPH/CGI script for extended redirects ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## $| = 1; $url = $ENV{'PATH_INFO'}; print "HTTP/1.0 302 Moved Temporarily\n"; print "Server: $ENV{'SERVER_SOFTWARE'}\n"; print "Location: $url\n"; print "Content-type: text/html\n"; print "\n"; print "<html>\n"; print "<head>\n"; print "<title>302 Moved Temporarily (EXTENDED)</title>\n"; print "</head>\n"; print "<body>\n"; print "<h1>Moved Temporarily (EXTENDED)</h1>\n"; print "The document has moved <a HREF=\"$url\">here</a>.<p>\n"; print "</body>\n"; print "</html>\n"; ##EOF##
ÁçÇ?Èù mod_rewrite
ÀÅ Ñ?Ñ? ÉîÑ?È?×ßÄÒ
È?Å÷ URL schemeÐÈÇÞ È?ÄéÐÜÇÊÌ××â Ì? ÐæÄé. ÏÉÈ? ÅùÎþ,
ÄéÐÍÀ? ÀÀÐÜ news:newsgroup
ÐÈÇÞ È?ÄéÐÜÇÊÌ××â
Ì? ÐæÄé
RewriteRule ^anyurl xredirect:news:newsgroup
xredirect:
È? ÈÆÑ?ÈÇÏÅ Ø?Ðõ×èÎï ×ßÁòÆ?É?ÏÅ
ÁäÔ?ÏÅ [R]
ÐÜÃ? [R,L]
ÐË Ë÷Ïû×ßÈù
ÎØÅØÄé.http://www.perl.com/CPANÏÅ
ÐæÄÒ ÄûÄì×á CPAN (Comprehensive Perl Archive Network)ÐË
ÎÖÄÒÀÅ? ÐÜ ÑæÌâÄÒ ÌÌÀøÏÅ Ø?ÎþÑ? Ï?Ç? CPAN ÉÜÇ? FTP
Ì-É?Ñï Õ?Æ?ÐÜÎ?Ö?ÏÅ ÀÅÁþÐÜ ÐæÄÒ Ì-É?ÇÞ È?ÄéÐÜÇÊÌ××áÄé.
ÐÜÈ? FTP Ñ?Áé ÑïÀø Ì-ÊåÍÊÆ?Àý ×áÄé. CPANÐÊ CGI ÍÊÕ?ÈÃÖ?È?
Ë÷Ïû×ßÑ?ÈÈ, mod_rewrite
È? Ë÷Ïû×ßÏ?
ÊåÍÑ×ßÀä ÈÈÅù Ì? ÐæÐËÁþ?
ÈåÐ? mod_rewrite
3.0.0 É?Ð?ÊÞÕÝ
È?ÄéÐÜÇÊÌ×ÏÅ "ftp:
" schemeÐË Ë÷Ïû×â Ì?
ÐæÄé. ÄéÐÍÐÈÇÞ Õ?Æ?ÐÜÎ?Ö?Ð× ÓæË?Ð? ÅÅÈîÐÞÐË RewriteMap
À? ÀÀÐÜ
Ë÷Ïû×ßÏ? Ð?ÔÅÈ? ÓïÑ?×â Ì? ÐæÄé. ÊÉÐòØ? Ï?ÐÞ ÁäÔ?ÏÅÌ-
ÓæË?Ð? ÅÅÈîÐÞÐË ÑïÀøÈÚÐ× ÕÀÇÞ Ë÷Ïû×áÄé.
RewriteEngine on RewriteMap multiplex txt:/path/to/map.cxan RewriteRule ^/CxAN/(.*) %{REMOTE_HOST}::$1 [C] RewriteRule ^.+\.([a-zA-Z]+)::(.*)$ ${multiplex:$1|ftp.default.dom}$2 [R,L]
## ## 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##
ÍÓÀ?ÏÅ Å?Æ? ÄéÈ? ÃËÏûÐË Ì-ÊåÍÊ×ßÄÒ ÀöÏü ÈÉÐÊ Ð?À?È?ÐêÄÒ
ÐñÍÓ Ö?ÊÀ×á ÖôÐÜÑ?ÇÞ È?ÄéÐÜÇÊÌ××ßÁòÐ?×è CGI ÍÊÕ?ÈÃÖ?È?
Ë÷Ïû×áÄé. mod_rewrite
ÇÞÄÒ ÎþÆËÀä
×â Ì? ÐæÄÒÀÅ?
Ð÷ÐëÌÊ ÑÆÀ×ÏÅÌ- Ë÷Ïû×â Ì? ÐæÄÒ Ï?Ç? TIME_xxx
Ê?Ì?ÀÅ ÐæÄé. Ê?Ì?ÏÝ Ö?ÊÀ×á Ë÷Ð?Ì?Ì- ÊåÁÃ
<STRING
, >STRING
,
=STRING
ÐË Ë÷Ïû×ßÏ? ÍÓÀ?ÏÅ Å?Æ? È?ÄéÐÜÇÊÌ××â
Ì? ÐæÄé:
RewriteEngine on RewriteCond %{TIME_HOUR}%{TIME_MIN} >0700 RewriteCond %{TIME_HOUR}%{TIME_MIN} <1900 RewriteRule ^foo\.html$ foo.day.html RewriteRule ^foo\.html$ foo.night.html
URL foo.html
ÐË ÏôÓË×ßÈù
07:00-19:00
ÅÏÎØ foo.day.html
ÃËÏûÐË Ì-ÊåÍÊ×ßÀý, Ã?ÈãÑ? ÍÓÀ? ÅÏÎØ
foo.night.html
ÃËÏûÐË Ì-ÊåÍÊ×áÄé. Ø?ÖôÐÜÑ?ÏÅÌ-
Ë÷Ïû×ßÁò ÑÑÐÊ ÁòÄÙÐÜÄé...
Ï?Ç? .html
ÖÔÐßÐË .phtml
ÇÞ
Ê?Ø?×ßÄÒ Åþ document.YYYY
È?
document.XXXX
ÇÞ ÐÜÐ?×áØÔ Ï?Ø?Ø?(backward
compatibility) URLÐË (ÀÅË?Ð?ÐÈÇÞ ÑÈÐ÷×ßÀä) ÈÈÅù Ì?
ÐæÃ??
ÐÜÈ?ÐË ÁòÊËÐÜÈ?ÐÈÇÞ Ð÷ÐëÌÊ×áØÔ Ë?ÇÞÏþ Ø?ÐõÐêÈ? ÀÅÑ? ÖÔÐßÐÜ ÐæÄÒÑ? ÀÛË÷×áÄé. ÐæÄéÈù Áç ÖÔÐßÈýÐË Ë÷Ïû×ßÀý, Î?ÐÈÈù URLÐË Ï?ÇÅ Ë?ÕÒÇÞ Ð÷ÐëÌÊ×áÄé.
# É?Ì-.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
ÓæÁé foo.html
ÐË bar.html
ÇÞ
Ê?Àö×ßÀý Ï?Ø?Ø?ÌÊÐË Ð?×è ÐÜÐ? URLÐË ÀøÌã Ñ?À?×ßÀý
ÍÝÄéÀý ÀÅÑ?×ßÐê. Ë÷ÏûÐêÄÒ ÐÜÐ? URLÐÜ Ê?ÀöÅ×Î?ÄéÄÒ
Ë÷Í×ÐË Ä?ÔÅÓ?Ñ? È?×áÄé.
ÄéÐÍ ÁäÔ?ÐÈÇÞ ÐÜÐ? URLÐË ÃËÊÞÐ?ÐÈÇÞ Ë?ÇÞÏþ URLÇÞ Ð÷ÐëÌÊ×áÄé:
RewriteEngine on RewriteBase /~quux/ RewriteRule ^foo\.html$ bar.html
ÄéÍÓ foo.html
ÐË bar.html
ÇÞ
Ê?Àö×ßÀý Ï?Ø?Ø?ÌÊÐË Ð?×è ÐÜÐ? URLÐË ÀøÌã Ñ?À?×ßÀý
ÍÝÄéÀý ÀÅÑ?×ßÐê. ÁçÇ?Ã? ÐÜÑ?ÄÒ ÐÜÐ? URLÐË Ë÷Ïû×ßÈù
Ë÷ÏûÐêÏÅÀä Ë?ÇÞÏþ URLÐË Ø?Ö?ÇÞ ÎÛÇÑÑèÄé. Ñÿ, ÊúÆ?ÏüÐ?
ÑæÌâÓ?ÐÜ Ê?×áÄé.
Ë?ÇÞÏþ URLÇÞ HTTP È?ÄéÐÜÇÊÌ××ßÄé. ÁçÇ?Èù ÊúÆ?ÏüÐ?ÀÅ Ë?ÇÞÏþ URLÈ? ÊÈÐÜÀý Ê?ÀöË÷Í×ÐË Ë÷ÏûÐêÀÅ ÎÛÀäÅØÄé:
RewriteEngine on RewriteBase /~quux/ RewriteRule ^foo\.html$ bar.html [R]
ÓæÌâ×á ÑïÏô×á ÓæË?Ð? ÖôÐÜÑ?ÄÒ ÊúÆ?ÏüÐ?ÏÅ ÓæÐ?Ø-ÅØ ÃËÏûÐÈÇÞ Ì-ÊåÍÊ×èÎï×â ÀöÏüÀÅ ÐæÄé. Ñÿ, ÓæÍÕ Netscape ÊúÆ?ÏüÐ?ÏÅÀäÄÒ ÓæË?Ð× É?Ð?ÐË, Lynx ÊúÆ?ÏüÐ?ÏÅÀäÄÒ ÓæÐ? É?Ð?ÐË, Ã?ÈãÑ? ÊúÆ?ÏüÐ?ÏÅÄÒ Ö?ÁåÐ?ÐÞ É?Ð?ÐË Ñ?À?×áÄé.
ÊúÆ?ÏüÐ?ÀÅ ÃËÏû×?Ë?ÐË Ð?×è ÐêÍÕÐ× ÑÎÇ?ÏÅ Äû×á Ñ?ÊÈÈ?
Ñ?À?×ßÑ? ÎÚÁòÆ?É?ÏÅ ÃËÏû×?Ë?ÐË Ë÷Ïû×â Ì? Î?Äé. ÄûÍÕ
HTTP "User-Agent" ×üÄ?È? Ë÷Ïû×áÄé. ÄéÐÍ ÁäÔ?ÐÊ HTTP
"User-Agent" ×üÄ?ÀÅ "Mozilla/3"ÐÈÇÞ ÍÓÐë×ßÈù
foo.html
ÖôÐÜÑ?È? foo.NS.html
ÇÞ
Ð÷ÐëÌÊ×ßÀý Ð÷ÐëÌÊÐË ÑïÄì×áÄé. ÊúÆ?ÏüÐ?ÀÅ "Lynx"Ã?
"Mozilla" É?Ð? 1 Ø?ÐÊ 2Æ?Èù URLÐÊ
foo.20.html
ÐÜ ÅØÄé. Ã?ÈãÑ? ÊúÆ?ÏüÐ?ÄÒ
foo.32.html
ÖôÐÜÑ?È? ÉîÄÒÄé. ÎÖÇÅ ÁäÔ?ÐÜ
ÐÜ ÐëÎ?ÐË ×áÄé:
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/3.* RewriteRule ^foo\.html$ foo.NS.html [L] RewriteCond %{HTTP_USER_AGENT} ^Lynx/.* [OR] RewriteCond %{HTTP_USER_AGENT} ^Mozilla/[12].* RewriteRule ^foo\.html$ foo.20.html [L] RewriteRule ^foo\.html$ foo.32.html [L]
ÏìÊÞ Ø?ÍÊÖ?ÏÅ ÏüÈ? Ë÷ÐÜÖ?ÇÞ ÀÅÑ?ÏÐÀý ÍÝÐÊ ÑÑÐÊ
Ð?ÖôÐÜÑ?ÀÅ ÐæÄéÀý ÀÅÑ?×ßÐê. FTP Ì-É?Ð× ÀöÏü Ñ?Ñ? ÏìÊÞ
ÐêÇñÐ× ÓæÍÕÊÉË÷ÊËÐË Ð?Ñ?×ßÄÒ mirror
×ÑÇÞÁçÇ?ÐË
Ë÷Ïû×â Ì? ÐæÀý, Ð?Ì-É?Æ?Èù HTTPÇÞ ÊåÍÑ×á ÐëÎ?ÐË ×ßÄÒ
webcopy
×ÑÇÞÁçÇ?ÐË Ë÷Ïû×â Ì? ÐæÄé. ÁçÇ?Ã?
ÅÞ ÉöÉ È?ÅÞ ÄìÑÅÐÜ ÐæÄé: ÊÉË÷ÊËÐÊ ÀÅÂ?ÎÏ ×ÑÇÞÁçÇ?ÐË
Í××ð×èÑé Æ?ÈÈ ÓæÍÕÖ×ÐÈÇÞ Ð?Ñ?ÅØÄé. Ñ?Ñ? ÁÈÌÊ×èÎï×ßÄÒ
Ñ?Ð?ÐÞ ÉÜÇ?ÀÅ ÎÖÄßÆ?Èù ÑÑÀêÄé. ÄûÍÕ (ÏìÊÞ Ø?ÍÊÖ?ÏÅÌ-
ÐêÇñÀÅ ÀËÍÕÅ×Èù) ×ÚÏô×âÆ? ÐêÅÏÐÈÇÞ ÐêÇñÈ? ÀËÍÕ×ßÄÒ
ÅÏÐ? ÉÜÇ?ÀÅ ×ÚÏô×ßÄé.
ÐÜÈ? Ð?×è Proxy Throughput ÁòÄÙÐË (×ÓÇÅÁç
[P]
) Ë÷Ïû×ßÏ? ÏìÊÞ Ð?ÖôÐÜÑ? Ø?ÐÊ ÏìÊÞ
Ð?À?À? Ð?ÓÌÈ? ÏüÈ? ÐÜÈ?À?À?ÐÈÇÞ ÄûÐÐ×áÄé:
RewriteEngine on RewriteBase /~quux/ RewriteRule ^hotsheet/(.*)$ http://www.tstimpreso.com/hotsheet/$1 [P]
RewriteEngine on RewriteBase /~quux/ RewriteRule ^usa-news\.html$ http://www.quux-corp.com/news/index.html [P]
RewriteEngine on RewriteCond /mirror/of/remotesite/$1 -U RewriteRule ^http://www\.remotesite\.com/(.*)$ /mirror/of/remotesite/$1
Í×Ñ? ÐêÇñÈ? ÉöØ-Ê?ÐÜ ÊÈØ?×ßÄÒ (ÃËÊÞ) ÐÞÖ?Æ?Ãí Ð?Ì-É?ÏÅ
(www2.quux-corp.dom
) Ð?Ðõ×ßÈùÌ-, ÁòÎ?Ð×
(ÏìÊÞ) ÐÞÕÝÃí Ð?Ì-É?È? (www.quux-corp.dom
)
Í××ð×ßÄÒ ÀÝÓÃÇà ÊÈÐÜÀä ×áÄé. ÏìÊÞ Ð?Ì-É?ÄÒ ÏôÓË×á
ÐêÇñÈ? ÃËÊÞ Ð?Ì-É?ÏÅÌ- ÀÅÑ?ÏÒÄé.
ÈåÐ? ÉöØ-Ê?ÐÜ ÃËÊÞ Ð?Ì-É?È? ÊÈØ?×ßÀý ÏìÊÞ Ð?Ì-É?ÈÈÐÜ ÃËÊÞ Ð?Ì-É?ÏÅÌ- ÐêÇñÈ? Î?ÐË Ì? ÐæÀä ×áÄé. ÄéÐÍÀ? ÀÀÐÜ ÖàÕÆ×ÚÕÝÈÅ ÉöØ-Ê?ÐË ÌÃÑ?×áÄé:
ALLOW Host www.quux-corp.dom Port >1024 --> Host www2.quux-corp.dom Port 80 DENY Host * Port * --> Host www2.quux-corp.dom Port 80
Í×Ñ? ÌÃÑ?É?ÉÏÅ ÎÛÈÒÀä ÀýÓÔÆ?. Î?ÄÒ ÐêÇñÈ? ÃËÊÞÐ?ÐÈÇÞ
proxy throughput ÁòÄÙÐË Õû×è ÏôÓË×ßÄÒ
mod_rewrite
ÁäÔ?ÐË ÐëÌÊ×áÄé:
RewriteRule ^/~([^/]+)/?(.*) /home/$1/.www/$2 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/home/([^/]+)/.www/?(.*) http://www2.quux-corp.dom/~$1/pub/$2 [P]
www.foo.com
Ð× ÕûÍÕÇ?ÐË
www[0-5].foo.com
(Óá Ì-É? 6Äû)ÐÈÇÞ ÊàËú×ßÀý
ÍÝÄé. ÎþÆËÀä ×ßÄÒÀÅ?
ÈÕÏü ÄéÎ÷×á ÉöÉÐÈÇÞ ÐÜ É?Ñ?È? ×èÀñ×â Ì? ÐæÄé.
ÈåÐ? DNSÈ? Ë÷Ïû×á Ðï ÎÛÇÑÑ? ÉöÉÐË ÌÃÈý×ßÀý,
mod_rewrite
È? Ë÷Ïû×ßÄÒ ÀöÏüÈ? ËüÖüÊÈÐê:
ÀÅÐõ À?Äì×á ÇÞÅõÉûÇÁÍÜ ÉöÉÐÊ BIND
Ð×
DNS round-robin ÉöÍÔÐË Ë÷Ïû×ßÄÒ ÀÝÐÜÄé. ÄéÐÍÀ?
ÀÀÐÜ DNS A(address) ÇÉÔêÅõÏÅ
www[0-9].foo.com
ÐË ÌÃÑ?×áÄé.
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
ÁçÈ?Àý ÄéÐÍ ×çÈåÐË ÓïÀÅ×áÄé:
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.
ÐïÈ?ÅØ ÀÝÓÃÇà ÊÈÐÜÑ?ÈÈ, Í×Ñ?ÇÞ BIND
Ð×
Ð×ÅÅÅØ ÁòÄÙÐÜÄé. ÐÜÑ? www.foo.com
ÐË
Ó?ÐÈÈù, BIND
ÄÒ ÈÕÉ? Ì?Ì-È? ÑÆÁíÎÏ
ÉéÂóÀÅÈ÷ www0-www6
ÐË ÉíØ?×áÄé. ÁçÇÅÌ-
Õ?Æ?ÐÜÎ?Ö?ÅùÐË Ï?Ç? Ì-É?ÇÞ ÊàËú×áÄé. ÁçÇ?Ã? DNS
ÀÛË? ÀñÀ?ÀÅ ÃçÖ?Ï?Ð× ÄéÈ? ÃçÐãÌ-É?ÏÅ ÔÃÍ?Å×Ï?
www.foo.com
ÐË Ó?ÐÊ ÀñÀ?ÀÅ Ö?Ñ?
wwwN.foo.com
ÐÜÈù Õ?Æ?ÐÜÎ?Ö?Ð× ÄéÐÍ
ÏôÓËÅùÅÅ ÀÀÐÊ wwwN.foo.com
ÐÈÇÞ
ÊÈÃËÑ?ÁòÆ?É?ÏÅ ÏßÊ?×á ÇÞÅõÉûÇÁÍÜ ÁòÉÐÜ ÎÖÄäÐË
ÑæÐ××ßÆ?. ÁçÇ?Ã? Õ?Àä ÊÈÈù ÏôÓËÐÜ Ï?Ç? Ð?Ì-É?ÏÅ
ÊàËúÅ×É×ÇÞ ØÏÀ?ÀÅ ÑÑÄé.
http://www.stanford.edu/~schemers/docs/lbnamed/lbnamed.htmlÏÅ
ÐæÄÒ lbnamed
×ÑÇÞÁçÇ?ÐË Ë÷Ïû×ßÏ?
Ñ?ÁÃ×á DNSÁòÉí ÇÞÅõÉûÇÁÍÜÐË ×â Ì? ÐæÄé. DNSÀÅ
Í×Ñ? ÇÞÅõÉûÇÁÍÜÐË ×ßÅÅÇß ÈÈÅõÄÒ Ï?Ç? ÅÅÁÈÏÝ Perl
5 ×ÑÇÞÁçÇ?ÐÜÄé.
ÐÜ ÉöÉÐÊ mod_rewrite
ÏÝ proxy
throughput ÁòÄÙÐË Ë÷Ïû×áÄé. ÈåÐ? DNSÏÅ ÄéÐÍ ×çÈåÐË
Ë÷Ïû×ßÏ? www0.foo.com
ÐÜ Í×Ñ?
www.foo.com
ÐË Ð?Äó×ßÀä ×áÄé
www IN CNAME www0.foo.com.
ÁçÈ?Àý www0.foo.com
ÐË ×ÑÇßÍÓÐ?Ïû
Ì-É?ÇÞ Ê?Àö×áÄé. Ñÿ, URLÐË ÉîÐÈÈù Ì-É?ÄÒ ÃËÊÞ
×ÑÇßÍÓÈ? Õû×è ÄéÈ? 5Äû Ì-É?Ñï (www1-www5
)
×áÄûÇÞ ÊÈÃËÁòÈÈ ×áÄé. ÐÜÈ? Ð?×è ÈåÐ? È?Å÷ URLÐË
ÇÞÅõÉûÇÁÍÜ ÍÊÕ?ÈÃÖ? lb.pl
ÇÞ ÊÈÃËÄÒ
ÁäÔ?ÐË ÈÈÅ÷Äé.
RewriteEngine on RewriteMap lb prg:/path/to/lb.pl RewriteRule ^/(.+)$ ${lb:$1} [P,L]
lb.pl
ÐË ÐëÌÊ×áÄé:
#!/path/to/perl ## ## lb.pl -- ÇÞÅõÉûÇÁÍÜ ÍÊÕ?ÈÃÖ? ## $| = 1; $name = "www"; # ÁòÊË Ø?ÍÊÖ?Èý $first = 1; # ÓÉÉ?ÒÀ Ì-É? (ÐêÍÕÐÜ 0ÐÜÁò Æ?É?ÏÅ, 0ÐË Ë÷Ïû×ßÑ? ÎÚÄÒÄé) $last = 5; # round-robinÏÅÌ- ÈÆÑ?ÈÇ Ì-É? $domain = "foo.dom"; # ÅÅÈîÐÞÈý $cnt = 0; while (<STDIN>) { $cnt = (($cnt+1) % ($last+1-$first)); $server = sprintf("%s%d.%s", $name, $cnt+$first, $domain); print "http://$server/$_"; } ##EOF##
www0.foo.com
ÏÅ ÊÞÄóÐÜ ÀÅÑ?ÎÚÄÒÀÅ?
ÉÀÇà, ÊÞÄóÐÜ ÅØÄé. ÁçÇ?Ã? ÄìÌ?×á proxy throughput
ÏôÓËÈÈ ×ßÁòÆ?É?ÏÅ Á?Ò?Äé! È?Å÷ SSI, CGI, ePerl
ÅþÐÊ Ð?Ð?ÐÈÇÞ ÄéÈ? Ì-É?ÀÅ ÓÃÈ?×áÄé. ÐÜÀÝÐÜ ×éÍÙÐÜÄé.×ßÅõÏ?ÎþÈ? Ë÷Ïû×á ×èÀñÓ?ÅÅ ÐæÄé. CiscoÄÒ TCP/IP Ì?ÑèÏÅÌ- ÇÞÅõÉûÇÁÍÜÐË ×ßÄÒ LocalDirectorÆ?ÄÒ Á?ÉÀÐË Ö×Äé. Í×Ñ?ÇÞÄÒ Ð?Ì-É?ÁÊ ÎåÄìÏÅ Ð?ÔÅ×ßÄÒ ÐßÑÎÐ× ØÈÇÞÌ?Ñè ÀäÐÜÖ?Ï?ÐÜÄé. ÐêÁíÐÜ ÓöÊà×ßÀý ÀýÌÊÄÙ ×èÀñÓ?ÐÜ ×ÚÏô×ßÄéÈù ÐÜÀÝÐË Ë÷Ïû×ßÆ?.
ÃçÖ?Ï?ÏÅÄÒ ÈêÑ? CGI ×ÑÇÞÁçÇ?ÅùÐÜ ÈÉÄé. ÁçÇ?Ã? Ë÷Ïû×ßÁò
É?ÀÕÇ?Ï?Ì- ÈÉÐÊ Ð?À?È?ÐêÀÅ Ë÷Ïû×ßÑ? ÎÚÄÒÄé. ÎÖÖÔÔÅÐ×
MIME-typeÏÅ Å?È? Action ×êÅùÇ? ÁòÄÙÅÅ CGI ×ÑÇÞÁçÇ?ÐÜ
Ö?ÊÀ×á URLÐË (Ñ?Ø?Ø? PATH_INFO
ÏÝ
QUERY_STRINGS
) ×ÑÇÞÁçÇ?Ð× ÐäÇÒÐÈÇÞ Ë÷Ïû×ßÑ?
ÎÚÐË Æ?ÈÈ Ð?Ð×ßÄé. ÈåÐ?, Ø?ÐõÐêÀÅ (secure CGIÈ? ÑéÏ?)
.scgi
ÐÞ ÖÔÐßÐË Ð?Èý×á cgiwrap
×ÑÇÞÁçÇ?ÐÈÇÞ ÓÃÈ?×ßÁòÐ?×è Ë?ÇÞÏþ typeÐË ÌÃÑ?×áÄé.
É?Ñ?ÄÒ (Ð?ÏÅÌ- ÊË) ÐßÀ?ÅØ URL ÁÈÑÆÈ? Ë÷Ïû×ßÄÒ ÀöÏü
Ë÷ÏûÐê Ø?Å?ÇÊÕôÈ?ÀÅ /u/user/foo/bar.scgi
ÀÀÐÊ
URLÐÞ ÑÅÐÜÄé. cgiwrap
ÄÒ
/~user/foo/bar.scgi/
×?ÍÔÐ× URLÐË
Ï?×ßÁòÆ?É?ÐÜÄé. ÄéÐÍ ÁäÔ?ÐÜ É?Ñ?È? ×èÀñ×áÄé:
RewriteRule ^/[uge]/([^/]+)/\.www/(.+)\.scgi(.*) ... ... /internal/cgi/user/cgiwrap/~$1/$2.scgi$3 [NS,T=application/x-http-cgi]
ÐÜÑ? ÄéÈ? ÈêÑ? ×ÑÇÞÁçÇ?, (URL ×ßÐ?Ö?È?ÏÅ Äû×á
access.log
È? ÓòÇÒ×ßÄÒ) wwwlog
ÏÝ
(URL ×ßÐ?Ö?È?ÏÅ GlimpseÈ? Í××ð×ßÄÒ) wwwidx
ÀÅ
ÐæÄéÀý ÀÅÑ?×ßÐê. ÏüÈ?ÄÒ ×ÑÇÞÁçÇ?ÏÅÀä ÐëÎ?×â ÄûË?ÐÞ
URL ÏÅÏ?ÐË ÎÛÇÑÑðÎï ×áÄé. ÁçÇ?Ã? ÏôÓË×âÆ?ÈÆÄé ×çË?
Ð?ÎþÑðÎï ×ßÁòÆ?É?ÏÅ Á?Â?×ßÑ? ÎÚÄé. Ñÿ, ÊÈÕû
/u/user/foo/
ÏÅ Äû×è swwidx
×ÑÇÞÁçÇ?ÐË Í××ð×áÄéÈù ÄéÐÍÀ? ÀÀÐÊ ÈÅÕ?È? Ë÷Ïû×áÄé
/internal/cgi/user/swwidx?i=/u/user/foo/
Á?Â?×ßÑ? ÎÚÄé. ÈÅÕ?ÏÅ ÏÅÏ?Ð× Ð?ÔÅÏÝ CGI Ð?ÔÅÈ? È?ÅÞ Ð?ÎþÎï ×ßÁòÆ?É?ÐÜÄé. ÏÅÏ?ÐË Ð÷ÁÈÌÊ×áÄéÈù Ï?Ç? ×ßÐÜÖëÈÅÕ?È? Ì?Ñ?×ßÄÒÅ? ÈÉÐÊ ÍÓÀ?ÐÜ ÀÙÈÁ ÀÝÐÜÄé.
×èÀñÓ?ÐÊ ÐêÅÏÐÈÇÞ Ð?Ð×á CGIÈ? Í××ð×ßÄÒ Ë?ÇÞÏþ Ö?ÊÀ×á URL ×?ÍÔÐË ÈÈÅõÄÒ ÀÝÐÜÄé. ÄéÐÍÀ? ÀÀÐÜ ÌÃÑ?×áÄé:
RewriteRule ^/([uge])/([^/]+)(/?.*)/\* /internal/cgi/user/wwwidx?i=/$1/$2$3/ RewriteRule ^/([uge])/([^/]+)(/?.*):log /internal/cgi/user/wwwlog?f=/$1/$2$3
ÐÜÑ? /u/user/foo/
ÐË ÀÛË?×ßÄÒ ÈÅÕ?ÄÒ
ÄéÐÍÀ? ÀÀÄé
HREF="*" /u/user/foo/* (???)
ÃËÊÞÐ?ÐÈÇÞ ÄéÐÍÀ? ÀÀÐÜ ÐêÅÏÊ?Ø?ÅØÄé
/internal/cgi/user/wwwidx?i=/u/user/foo/
ÀÀÐÊ ÉöÉÐÈÇÞ ÈÅÕ? ÅêÏÅ :log
È? Ë÷Ïû×ßÏ?
Ñ?Áé ÇÞÁç CGI ×ÑÇÞÁçÇ?ÐË Í××ð×â Ì? ÐæÄé.
ÎþÆËÀä ÊúÆ?ÏüÐ?ÏÝ Ë÷ÏûÐêÀÅ È?È?Àä ÐêÏ?ÍÊÇÄÀä Ñ?Ð?
ÖôÐÜÑ? foo.html
ÐË ÅÏÐ?ÐÞ foo.cgi
ÇÞ
Ê?Àö×â Ì? ÐæÃ?.
URLÐË CGI ÍÊÕ?ÈÃÖ?ÇÞ Ð÷ÐëÌÊ×ßÀý, MIME-typeÐË Ì?Ñ?×ßÏ?
CGI ÍÊÕ?ÈÃÖ?ÇÞ Í××ð×ßÀä ×áÄé. ÁçÇÅÌ-
/~quux/foo.html
È? ÏôÓË×ßÈù ÃËÊÞÐ?ÐÈÇÞ
/~quux/foo.cgi
È? Í××ð×ßÀä ÅØÄé.
RewriteEngine on RewriteBase /~quux/ RewriteRule ^foo\.html$ foo.cgi [T=application/x-httpd-cgi]
ÐÜ ÉöÉÐÊ Í×ÇÞ ÊåÁòÐÜÄé: ÅÏÐ?ÐÈÇÞ ÖôÐÜÑ?È? ËÌÊ×ßÑ?ÈÈ, Ñ?Ð?ÐÈÇÞ ÖôÐÜÑ?È? Ì-ÊåÍÊ×áÄé. Ñÿ, ÖôÐÜÑ?ÄÒ Ì?Ì?×ßÀä (ÖÔÐßÍÓÍÊÕëÏÅÌ- ÐàÐÊ ÃËÏûÐË ÁçÄûÇÞ) Ñ?Ð? ÖôÐÜÑ?ÇÞ Ð?ÄîÅ×Ñ?ÈÈ, Î?ÐË ÀöÏü Ð?Ì-É?ÀÅ ÅÏÐ?ÐÈÇÞ ËÌÊ×áÄé. ÁçÇ?Èù Ä?ÀÅ (Ø?ÐÊ cron ÐëÎ?ÐÜ) Ñ?Ð? ÔÑÕéÓ?È? Ñ?ÏüÑ?ÎÚÄÒ ×á CGIÀÅ ËÌÊ×á ÖôÐÜÑ?È? Ñ?Ð?ÐÈÇÞ Ì-ÊåÍÊ×áÄé. ÔÑÕéÓ?È? Ñ?ÏüÈù ÃËÏûÐË ÀËÍÕ×áÄé.
RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^page\.html$ page.cgi [T=application/x-httpd-cgi,L]
Ï?ÁòÌ- page.html
È? ÏôÓË×âÆ?
page.html
ÐÜ Î?ÀÕÃ? ÖÔÐßÕ?ÁòÀÅ 0ÐÞ ÀöÏü
ÃËÊÞÐ?ÐÈÇÞ page.cgi
È? Í××ð×áÄé. Ï?ÁòÌ-
ÊåÀñÐÊ page.cgi
ÀÅ ÐßÉíÐ?ÐÞ CGI ÍÊÕ?ÈÃÖ?ÏÝ
ÀÀÐÜ STDOUT
ÏÅ ÓòÇÒ×ßÀý, ÓïÀÅÇÞ ÓòÇÒÐË
page.html
ÖÔÐßÏÅ Ð?ÄÒÄé. ×áÉ? Í××ð×áØÔ
Ì-É?ÄÒ page.html
Ð× Ñ?ÊÈÈ? ÊÈÃÍÄé. Ð?À?È?ÐêÀÅ
À-Ð÷ÇÞ ÃËÏûÐË ÀËÍÕ×ßÀý ÍÝÄéÈù, (ÊÈÕû cron ÐëÎ?ÐÜ)
page.html
ÐË Ñ?ÏüÁòÈÈ ×ßÈù ÅØÄé.
ÊÉÐò×á Ð?ÖôÐÜÑ?È? ÈÈÅùÆ? ÖýÑÐêÀÅ ÃËÏûÐË Ì?Ñ?×â Æ?ÈÆÄé ÐêÅÏÐÈÇÞ ÖôÐÜÑ?È? Ë?ÇÞ ÀýÔ?×ßÄÒ Ð?ÊúÆ?ÏüÐ?ÀÅ ÐæÐÈÈù Î?ÈÆÃ? ÑÑÐËÁþ? ÊâÀÅÄÙ×áÀÅ?
ÀÅÄÙ×ßÄé! MIME multipart ÁòÄÙÀ? Ð?Ì-É? NPH ÁòÄÙ,
mod_rewrite
Ð× URL ÑÆÐë ÄÙÇÒÐË Àñ×å×ßÈù
ÅØÄé. ÈåÐ?, Ë?ÇÞÏþ URL ÁòÄÙÐË ÈÈÅ÷Äé: URLÏÅ
:refresh
È? ÓïÀÅ×ßÁòÈÈ ×ßÈù ÖÔÐßÍÓÍÊÕëÏÅÌ-
Ì?Ñ?ÅÙ Æ?ÈÆÄé Ë?ÇÞ ÀýÔ?×áÄé.
RewriteRule ^(/[uge]/[^/]+/?.*):refresh /internal/cgi/apache/nph-refresh?f=$1
ÐÜÑ? ÄéÐÍ URLÏÅ Ñ?Áé×ßÈù
/u/foo/bar/page.html:refresh
ÄéÐÍ URLÐË ÃËÊÞÐ?ÐÈÇÞ ÊÞÈ?Äé
/internal/cgi/apache/nph-refresh?f=/u/foo/bar/page.html
ÐÜÑ? NPH-CGI ÍÊÕ?ÈÃÖ?ÈÈ ÃÂÎâÄé. ÊÈÕû "ÅÆÐêÏÅÀä Ï?ÍÐÐÈÇÞ ÃÂÀìÅâ"ÐÜÆ?Àý ÈË×ßÑ?ÈÈ ;-) Ã?ÄÒ ÐÜÀÝÅÅ Ñ?À?×áÄé.
#!/sw/bin/perl ## ## nph-refresh -- NPH/CGI script for auto refreshing pages ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## $| = 1; # split the QUERY_STRING variable @pairs = split(/&/, $ENV{'QUERY_STRING'}); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/A-Z/a-z/; $name = 'QS_' . $name; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; eval "\$$name = \"$value\""; } $QS_s = 1 if ($QS_s eq ''); $QS_n = 3600 if ($QS_n eq ''); if ($QS_f eq '') { print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\n\n"; print "<b>ERROR</b>: No file given\n"; exit(0); } if (! -f $QS_f) { print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\n\n"; print "<b>ERROR</b>: File $QS_f not found\n"; exit(0); } sub print_http_headers_multipart_begin { print "HTTP/1.0 200 OK\n"; $bound = "ThisRandomString12345"; print "Content-type: multipart/x-mixed-replace;boundary=$bound\n"; &print_http_headers_multipart_next; } sub print_http_headers_multipart_next { print "\n--$bound\n"; } sub print_http_headers_multipart_end { print "\n--$bound--\n"; } sub displayhtml { local($buffer) = @_; $len = length($buffer); print "Content-type: text/html\n"; print "Content-length: $len\n\n"; print $buffer; } sub readfile { local($file) = @_; local(*FP, $size, $buffer, $bytes); ($x, $x, $x, $x, $x, $x, $x, $size) = stat($file); $size = sprintf("%d", $size); open(FP, "<$file"); $bytes = sysread(FP, $buffer, $size); close(FP); return $buffer; } $buffer = &readfile($QS_f); &print_http_headers_multipart_begin; &displayhtml($buffer); sub mystat { local($file) = $_[0]; local($time); ($x, $x, $x, $x, $x, $x, $x, $x, $x, $mtime) = stat($file); return $mtime; } $mtimeL = &mystat($QS_f); $mtime = $mtime; for ($n = 0; $n < $QS_n; $n++) { while (1) { $mtime = &mystat($QS_f); if ($mtime ne $mtimeL) { $mtimeL = $mtime; sleep(2); $buffer = &readfile($QS_f); &print_http_headers_multipart_next; &displayhtml($buffer); sleep(5); $mtimeL = &mystat($QS_f); last; } sleep($QS_s); } } &print_http_headers_multipart_end; exit(0); ##EOF##
ÀÅË?Ø?ÍÊÖ?ÀÅ ÈþÀÃÈÈ ÐæÄéÈù ÎÖÖÔÔÅÐ× <VirtualHost>
ÁòÄÙÐÜ Ðï ÅÏÐë×áÄé. ÁçÇ?Ã? ÀÅË?Ø?ÍÊÖ?ÀÅ Ì?ÉùÀà ÐæÄÒ
ISPÆ?Èù ÐÜ ÁòÄÙÐÜ ÓæÌÁÐÊ ÎÖÄßÄé.
ÐÜ ÁòÄÙÐË Ñ?À?×ßÇÑÈù Proxy Throughput
ÁòÄÙÐË (×ÓÇÅÁç [P]
) Ë÷Ïû×ßÏ? ÏìÊÞ Ð?ÖôÐÜÑ?
Ø?ÐÊ Ð?ÓÌ ÏìÊÞ Ð?ÏÅÏ?ÐË ÏüÈ?Ð× ÐÜÈ?À?À?ÏÅ ÄûÐÐ×áÄé:
## ## 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
## ## httpd.conf ## : # È?ÄéÐÜÇÊÖ?×âÆ? Ñ?Áä Ø?ÍÊÖ?ÈýÐË Ë÷Ïû×áÄé. UseCanonicalName on : # ÀÅË?Ø?ÍÊÖ?È? CLF ×?ÍÔ ÎåÏÅ ÓïÀÅ×áÄé CustomLog /path/to/access_log "%{VHOST}e %h %l %u %t \"%r\" %>s %b" : # ÑæÌ-É?ÏÅÌ- Ð÷ÐëÌÊ Ï?Ñ?ÐË Ë÷Ïû×áÄé RewriteEngine on # ÅÞ ÈÚÐË Ñ?Ð××áÄé: ×ßÃ?ÄÒ URLÐË ÀýÔÅÀý, # ÄéÈ? ×ßÃ?ÄÒ ÀÅË?Ø?ÍÊÖ?ÊÀ DocumentRootÈ? # Ñ?Ð××áÄé. RewriteMap lowercase int:tolower RewriteMap vhost txt:/path/to/vhost.map # ÐÜÑ? Õ?Àý ÊÉÐò×á ÁäÔ? ×áÀÃÈ? Ë÷Ïû×ßÏ? # ÀÅË?Ø?ÍÊÖ?ÇÞ ÄûÐÐ×áÄé. # # 1. ÀÅË?Ø?ÍÊÖ?ÅùÐÜ ÀÀÐÜ Ë÷Ïû×ßÄÒ Ð?ÔÅÄÒ ÄûÐÐ×ßÑ? ÎÚÄÒÄé RewriteCond %{REQUEST_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}}] :
ÎþÆËÀä ×ßÈù Ö?Ñ? Ð?À?À?Ð× ÖôÐÜÑ?È? ÁìÎþÈ?ÐÈÄÒ ÁÝÒ?ÐÊ
ÇÞÊÏÐË ÈÇÐË Ì? ÐæÃ?? "Robot Exclusion Protocol" ×çÈåÐË
Ð?Ðõ×á /robots.txt
ÖÔÐßÐÊ ÊÈÕû ÐÜÇÁ ÇÞÊÏÐË
ÈÇÄÒÅ? ÓöÊà×ßÑ? ÎÚÄé.
(ÎÖÈÆÅÅ Å?ÇÊÕôÈ?ÀÅ ÁýÎþÌ- ÇÞÊÏÐÜ ÅÉÎÖÄéÄßÈù Ì-É?ÏÅ
ÊÞÄóÐÜ Õ? ÀöÏü) Ð?À?À? /~quux/foo/arc/
ÏÅ
ÐæÄÒ URLÅùÐË ÀÕÊÞ×ßÄÒ ÁäÔ?ÐË Ë÷Ïû×áÄé. ÏüÈ?ÄÒ Ö?Ñ?
ÇÞÊÏÐ× Ñ?ÁéÐË ÈÇÎÖÎï ×áÄé. Ñÿ, ÇÞÊÏÐË Í××ð×ßÄÒ Ø?ÍÊÖ?È?
ÈÇÄÒ ÀÝÐÈÇÞÄÒ ÊâÓöÊà×ßÈ÷, Áç Ø?ÍÊÖ?Ð× Ë÷ÏûÐêÅÅ ÈÇÎÖÉ?È?Àä
ÅØÄé. User-Agent HTTP ×üÄ? Ñ?ÊÈÅÅ ÊåÁÃ×áÄé.
RewriteCond %{HTTP_USER_AGENT} ^NameOfBadRobot.* RewriteCond %{REMOTE_ADDR} ^123\.45\.67\.[8-9]$ RewriteRule ^/~quux/foo/arc/.+ - [F]
http://www.quux-corp.de/~quux/
ÏÅ ÐæÄÒ
ÖôÐÜÑ?ÅùÐÜ GIF ÁçÈÂÐË Ö?×ä×áÄéÀý ÀÅÑ?×ßÐê. ÐÜ ÁçÈÂÐÜ
ÈêÐæÎþÌ-, ÄéÈ? Ë÷Æ?ÅùÐÜ ÐêÍÕÐ× ÖôÐÜÑ?ÏÅ Ñ?Ñ? ÈÅÕ?È?
À×Äé. Ì-É?ÏÅ Êâ×ÚÏô×á ÊÞÄóÐÜ Å×É×ÇÞ ÈÇÀý ÍÝÄé.
ÁçÈÂÐË 100% ÊÈØ?×â Ì?ÄÒ Î?Ñ?ÈÈ, ÓæÌâ×á ÊúÆ?ÏüÐ?ÀÅ HTTP Referer ×üÄ?È? ÊÈÃËÄÒ ÀöÏü Ñ?×á×â Ì? ÐæÄé.
RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://www.quux-corp.de/~quux/.*$ [NC] RewriteRule .*\.gif$ - [F]
RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !.*/foo-with-gif\.html$ RewriteRule ^inlined-in-foo\.gif$ - [F]
ÎþÆËÀä ÏìÊÞÏÅÌ- Ì-É?ÏÅ Ñ?Áé×â Ì? Î?ÄÒ Ø?ÍÊÖ? ÈåÇßÐË ÌÃÑ?×â Ì? ÐæÃ??
ÎÖÖÔÔÅ >= 1.3b6ÏÅÌ-:
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]
ÎÖÖÔÔÅ <= 1.3b6ÏÅÌ-:
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
## ## hosts.deny ## ## ÑæÐ×! ÐÜÀÝÐÊ ÈåÇßÓÃÇà ÊÈÐÜÑ?ÈÈ ÈåÇßÐÜ ÎÖÄßÆ? ÈÚÐÜÄé. ## mod_rewriteÄÒ ÐÜ Ñ?ÊÈÈ? ÕÀ/À? ÍæÐÈÇÞ ×èÌ?×ßÁòÆ?É?ÏÅ, ## À? ×çÈåÐ× À? ÐêÈ?ÏÅ ÓæÌâ×á "-"ÀÅ ×ÚÏô×ßÄé. ## 193.102.180.41 - bsdti1.sdm.de - 192.76.162.40 -
ÎþÆËÀä Ö?Ñ? Ø?ÍÊÖ? Ø?ÐÊ Ö?Ñ? Ø?ÍÊÖ?Ð× Ë÷ÏûÐêÀÅ ÎÖÖÔÔÅ ×ÑÇßÍÓÈ? Ë÷Ïû×â Ì? Î?ÅÅÇß ×ßÃ??
ÈåÐ? ÎÖÖÔÔÅ Ð?Ì-É?È? ÔÔÖÔÐß×âÆ? ÁÈÌÊÖÔÐßÏÅÌ-
mod_rewrite
ÀÅ mod_proxy
ÎÖÇÅÏÅ(!) ÐæÎþÎï ×áÄé. ÁçÇ?Èù mod_rewrite
ÄÒ
mod_proxy
ÐÜÐ?ÏÅ ÊâÈÀÄé.
ÐÜÑ? ÄéÐÍÀ? ÀÀÐÜ Ö?Ñ? Ø?ÍÊÖ?È? ÀÕÊÞ×ßÅÅÇß ÌÃÑ?×áÄé...
RewriteCond %{REMOTE_HOST} ^badhost\.mydomain\.com$ RewriteRule !^http://[^/.]\.mydomain.com.* - [F]
...ÁçÈ?Àý ÄéÐÍÐÊ user@hostÏÅ Å?Æ? ÀÕÊÞ×áÄé:
RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} ^badguy@badhost\.mydomain\.com$ RewriteRule !^http://[^/.]\.mydomain.com.* - [F]
ÀÅÂ? ÈÕÏü Ö?ÊÀ×á ÐÞÑ?ÐÜ ×ÚÏô×â Æ?ÀÅ ÐæÄé. ÏÉÈ?
ÅùÎþ, ÉÜÈ? ÌÃÑ?×èÅà Ë÷ÏûÐêÐÞÑ? ÀÛË÷×áÄé. ÐÜÅùÏÅÀäÈÈ
(mod_auth_basic
Ð× Basic AuthÈ? Ë÷Ïû×á
ÀöÏüÏÝ ÄîÈ?) ÊÀÄéÈ? ÉÀÐÍÎ?ÐÜ Ñ?ÁéÐË ×óÏû×áÄé.
Ô?ÁÈÈÈ Ñ?ÁéÐÜ ÀÅÄÙ×ßÅÅÇß Ð÷ÐëÌÊ ÁäÔ?ÅùÐË Ë÷Ïû×áÄé:
RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} !^friend1@client1.quux-corp\.com$ RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} !^friend2@client2.quux-corp\.com$ RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} !^friend3@client3.quux-corp\.com$ RewriteRule ^/~quux/only-for-friends/ - [F]
"Referer" HTTP ×üÄ?ÏÅ Å?Æ? Ï?×ßÄÒÄûÇÞ Ò?ÑÆÖôÐÜÑ?È? ÌÃÑ?×â Ì? ÐæÄÒ Ð?Ï?×á URL Ê?Ø?ÁòÈ? ÈÈÅù Ì? ÐæÄÒÀÅ?
ÄéÐÍÀ? ÀÀÐÜ ÊÉÐò×á ÁäÔ?ÐË...
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]
... Ð÷ÐëÌÊ ÈÚÀ? ÀÀÐÜ Ë÷Ïû×áÄé:
## ## 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/
ÁçÇ?Èù ÏôÓËÐË ÐêÅÏÐÈÇÞ (ÈÚÏÅÌ- À?ÐÈÇÞ "-
"È?
Ë÷Ïû×á ÀöÏü) Ò?ÑÆÖôÐÜÑ?Ã? (URLÐÜ ÈÚÏÅ ÐæÄÒ ÀöÏü ÅÞÉ?ÒÀ
ÎÖÁäÈåÖ?ÇÞ) Ö?Ñ? URLÇÞ È?ÄéÐÜÇÊÌ××áÄé.
FAQ: ÎþÆËÀä ÐÜÇÁÐ?ÇÁ ÐòÄé×á É?Ñ?È? ×? Ì? ÐæÄÒÀÅ?
mod_rewrite
ÇÞÄÒ ×èÀñÓ?ÐÜ ÎØÊÈÐÞÄé...
ÏìÊÞ RewriteMap
ÐË Ë÷Ïû×ßÆ?.
Ñÿ, ×ÑÇÞÁçÇ?ÐÜ RewriteMap
Ï?×âÐË
×áÄé. ×ÑÇÞÁçÇ?ÐÊ ÎÖÖÔÔÅÀÅ ÍÓÐë×âÆ? ÍÓÐë×ßÏ?
STDIN
ÏÅÌ- ÏôÓË×á URLÐË ÉîÀý, (ÀÀÐÊ Ì?Ì-ÇÞ!)
ÀñÀ? (ÊÈÕû Ð÷ÐëÌÊÅØ) URLÐË STDOUT
ÏÅ ÓòÇÒ×áÄé.
RewriteEngine on RewriteMap quux-map prg:/path/to/map.quux.pl RewriteRule ^/~quux/(.*)$ /~quux/${quux-map:$1}
#!/path/to/perl # ÎÖÖÔÔÅ Ì-É?ÀÅ ÈèÓïÑ? ÎÚÅÅÇß # ÐäÓòÇÒ É?ÖëÈ? Ë÷Ïû×ßÑ? ÎÚÄÒÄé $| = 1; # stdinÏÅÌ- ×áÑéÎÏ URLÐË ÐàÀý # stdoutÏÅ Ê?Ø?×á URLÐË ÓòÇÒ×áÄé while (<>) { s|^foo/|bar/|; print $_; }
ÌÃÈý×ßÁòÐ?×è È?Å÷ /~quux/foo/...
URLÐË
/~quux/bar/...
ÇÞ Ð÷ÐëÌÊ×ßÄÒ ÍÊÕ?ÈÃÖ?È?
ÏÉÇÞ ÅùÎ?Äé. Í×Ñ?ÇÞ ÈÆÐÍÄûÇÞ ×ÑÇÞÁçÇÅÉæ×â Ì? ÐæÄé.
ÁçÇ?Ã? ÐßÉí Ë÷ÏûÐêÀÅ ÐÜÇÁ ÈÚÐË Ë÷Ïû×â
Ì? ÐæÄéÀý ×ßÄ?Æ?Àý, ÏÐÑ? ÍÓÍÊÕë À?È?ÐêÈÈÐÜ ÈÚÐË
Ñ?Ð××èÎï ×äÐË ÑæÐ××ßÆ?.