<-
Apache > HTTP Server > Documentation > Version 2.4

URL@ HϳCz ġ [[

݋b _ _ Ɯ”. ٿ ~@ ݋ O[.

݋b ] URL@ O Hġ ݋z H HϳCzۻ ġ ãb Ѵ.

Support Apache!

O

top

L C

top

DocumentRoot

]@ ޻@ Hġb H@ ݋z r[ ⺻ڷ ] URL-(URL݋ xzh h ڿ b κ) rHϿ݋ r DocumentRoot ڿ δ. E݋ DocumentRoot Eb Hϰ 丮@ ݋ Ե ⺻ ~ƴ.

top

DocumentRoot ^ b Hϵ

vv HϳCzۿ݋ DocumentRoot E ʻ@ κ@ ݋ ʿ䰡 . Hġb \ Ҏ^@ ȝ~ ] . Ϟ[z Czۿ݋ Ur ȝ~[ HϳCz ٸ κ@ DocumentRoot E ] . @ Hġb ش 丮 Options r FollowSymLinks SymLinksIfOwnerMatch b 쿡 Ur 󰣴.

, Alias Cb HϳCz Ưr κ@ [Ѵ. 齁 ٞ ٔR

Alias /docs /var/web

URL http://www.example.com/docs/dir/file.html@ /var/web/dir/file.html@ O ݋zѴ. r ο b ~@ CGI zrxh ޸[b @ ܸ[Ob ScriptAlias Cn @ @ Ѵ.

AliasMatch ScriptAliasMatch C K rFe^ [ ġ ȝ~[ Ϟ r ɸ[. 齁,

ScriptAliasMatch ^/~([a-zA-Z0-9]+)/cgi-bin/(.+) /home/$1/cgi-bin/$2

b http://example.com/~user/cgi-bin/script.cgi ]@ /home/user/cgi-bin/script.cgi [[O, ش H@ CGI zrxh Ѵ.

top

ȝ~ 丮

Ϟ[z Czۻ@ ڷ Ưr ȝ~ user~user/ ĪѴ. mod_userdir @ @ M Ȯ[, ٞ @ URL@ O ȝ~ 丮 ȿ b H@ ݋zѴ.

http://www.example.com/~user/file.html

Ȼ ݋ ȝ~ 丮 ] ڔR ȵȴ. E݋ UserDir Cb ȝ~ 丮݋ ~ Hϵ @ 丮 rѴ. ⺻ r Userdir public_html@ ȝ~[O /home/user/ /etc/passwd r ȝ~ 丮R, URL@ H /home/user/public_html/file.html [Ѵ.

, Userdir Cb /etc/passwd 丮 ġ vʾb Cz@ \ ٸ ¸ ȝ~ ] .

ȝ@ ( ݋ %7e ΃ȵǾb) "~" x ƻ[ ٸ Ҏeڷ ȝ~ 丮 tO ͽѴ. ɻ@ mod_userdir [ʾb. ׵\ ȝ~ 丮 Ģ Ҏ^ڷ 伺ǘٔR, AliasMatch C ȝ~[ [b ȿ @ ] . 齁, ٞ AliasMatch C ȝ~[R http://www.example.com/upages/user/file.html /home/user/public_html/file.html [Ѵ:

AliasMatch ^/upages/([a-zA-Z0-9]+)/?(.*) /home/$1/public_html/$2

top

URL ٓƷӛ(Redirection)

տ݋ r C@ Hġ HϳCz Ưr ҿ b ~@ Ŭƾh 늴. ׵\ VV ] ~ ٸ URL ٽO Ŭƾh ˷ֽ, Ŭƾh ؛ URL@ ][nU b ͓ @ V . Ƹ ٓƷӛ(redirection)ƶO [, Redirect C ȝ~Ѵ. 齁, DocumentRoot E /foo/ 丮 ~@ ؛ /bar/ 丮 wٔR ٞ Ŭƾh ؛ο ġ ][nU Ѵ:

Redirect permanent /foo/ http://www.example.com/bar/

׵\R www.example.com ݋L /foo/ C۸[b URL-ξb /foo/ /bar/ ٲ URL ٓƷӛȴ. Ŭƾh E ݋Lܿ ٸ ݋LΙn ٓƷӛ ] .

, Hġb ۼ RedirectMatch C Ѵ. 齁, ٸ ]@ ״ νO ȝh ]@ ٸ ȝh ٓƷӛ[R:

RedirectMatch permanent ^/$ http://www.example.com/startpage.html

ӳC ȝh ٸ ȝh Ưr ٓƷӛ[R:

RedirectMatch temp .* http://othersite.example.com/startpage.html

top

_UC(Reverse Proxy)

Hġb ٸ ݋L b ݋ ݋L URL ڷ ] . ݋L ݋L݋ ݋ ݋ Ŭƾh ޸[b UC ݋L ۸[V얿 Ʒ Ҏ^@ _UC(reverse proxying)O Ѵ. Ŭƾh 忡݋ _UC ݋L ݋ ־b Q ƹǷ ^ UC;b ٸ.

E r݋ Ŭƾh /foo/ b ݋ ][R, ݋Lb internal.example.com /bar/ 丮݋ ݋ ݋ ݋ ġ ݋L Q Ŭƾh .

ProxyPass /foo/ http://internal.example.com/bar/
ProxyPassReverse /foo/ http://internal.example.com/bar/

ProxyPassb ݋L ݋ nU r[, ProxyPassReverse Cb internal.example.com b ٓƷӛ@ ۼ[ ٓƷӛ ݋L 丮 ŰnU Ѵ. , ProxyPassReverseCookieDomain ProxyPassReverseCookieDomain@ @ Ҏ^ڷ E ݋L Ű ۼѴ.

׵\ ݋ ȿ b rb ۼ[ ʞ@ Ǹ[. internal.example.com 븵rb Ŭƾh UC݋L ” internal.example.comڷ ][ Ѵ. ڰ mod_proxy_html @ ȝ~[ HTML XHTML b r ۼ ] .

top

ۼ (Rewriting Engine)

K ġȯ ʿV mod_rewrite ۼ n ȴ. Cb v v Ŭƾh IP ּ ] Ư¡@ O b ~@ ݋z r ] . , mod_rewriteb ]@ Q r[ ܺ Γͺz HϓƳ α׷@ ȝ~ ] . ۼ @ ݋ ٷ v [, , ٓƷӛ (alias), ܺ ٓƷӛ, UC, θ Ѵ. mod_rewrite ȝ~[b b URL ۼ ħ݋݋ Ѵ.

top

File Not Found

v ] URL [[b H@ HϳCzۿ݋ ã o ƴ. \ Ϟ . ݋ ٸ ^ڷ w V ] . Ŭƾh URL ٓƷӛڷ ڿ ؛ο ġ ˷־b Ҏ^ . ׵\R ڿ@ wn E ϸr r Ϟȿ[.

"File Not Found" ٸ ^ λ@ v Ȥ@ HTML r URL ߽o µ ƴ. Hġb mod_speling (^ Ʋ ʾҞ) ƿ @ b. @ ȝ~[R "File Not Found" Te[b Hϸ@ ڿ@ ãb. T߸[R mod_speling@ Ŭƾh ùٸ ġ HTTP ٓƷӛѴ. "" Hϓ \ ٔR Ŭƾh U@ .

mod_speling Ư Ϟ~ @ ڸ 亰[ʽO Hϸ@ 񱳸[b ɓƴ. E݋ Ϟ[z HϳCz۰ URL @ o[b ȝ~ڰ b Czۿ n ȴ. ׵\ mod_speling URL@ OľѴٔR, "߽o" ]V URL ٓƷӛ Ŭƾh ؛ο ] ϽǷ ݋L δ ȴ.

ãb Cn и[R Hġb HTTP status code 404 (file not found) . ~@ ErrorDocument C [, ȝ~ڞr [ ݋ O[ ȝ~ڞr ] .

:  en  |  fr  |  ja  |  ko  |  tr 

top

Comments

Notice:
This is not a Q&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 mailing lists.
С͸