璇存槑
|
鏄犲皠URL鍒版枃浠剁郴緇熺殑鐗瑰畾鍖哄煙 |
璇硶
|
Alias URL-pathfile-path|directory-path
|
浣滅敤鍩?/a>
|
server config, virtual host |
鐘舵?/a>
|
鍩烘湰(B) |
妯″潡
|
mod_alias |
Alias
鎸囦護(hù)浣挎枃妗e彲浠ヨ瀛樺偍鍦?code class="directive">DocumentRoot浠ュ鐨勬湰鍦版枃浠剁郴緇熶腑銆備互(%宸茶В鐮佺殑)url-path璺緞寮澶寸殑URL鍙互琚槧灝勫埌浠?var>directory-path寮澶寸殑鏈湴鏂囦歡銆?/p>
紺轟緥錛?/h3>
Alias /image /ftp/pub/image
瀵?http://myserver/image/foo.gif"鐨勮姹傦紝鏈嶅姟鍣ㄥ皢榪斿洖"/ftp/pub/image/foo.gif"鏂囦歡銆傚洜涓轟粎鍖歸厤瀹屾暣璺緞錛屾墍浠ヤ笂榪頒緥瀛愪笉浼?xì)鍖归厤瀵?http://myserver/imagefoo.gif"鐨勮姹傘傚浜庝嬌鐢ㄦ鍒欒〃杈懼紡鐨勫尮閰嶏紝璇峰弬瑙?code class="directive">AliasMatch鎸囦護(hù)銆?/p>
娉ㄦ剰錛氬鏋?var>url-path涓湁鍚庣紑"/"錛屽垯鏈嶅姟鍣ㄨ姹傛湁鍚庣紑"/"浠ユ墿灞曟鍒悕銆備篃灝辨槸璇?Alias /icons/ /usr/local/apache/icons/
"騫朵笉鑳藉"/icons
"瀹炵幇鍒悕銆?/font>
娉ㄦ剰錛屽彲鑳介渶瑕侀澶栨寚瀹氫竴涓?code class="directive"><Directory>孌墊潵瑕嗙洊鍒悕鐨?em>鏈緇堝璞?/em>銆傜敱浜庡彧鏈夊嚭鐜板湪<Directory>
孌典箣鍓嶇殑鍒悕鎵嶄細(xì)琚嫻嬶紝鎵浠ュ畠鍙鏈緇堝璞$敓鏁堛?鐢變簬鎵ц鍒悕鎿嶄綔涔嬪墠<Location>
孌典細(xì)琚鍏堟壂鎻忎竴嬈★紝鎵浠ュ畠浠篃鏄湁鏁堢殑)
鐗瑰埆鍦幫紝濡傛灉瀵瑰湪DocumentRoot
涔嬪鐨勬煇涓洰褰曞緩绔嬩簡(jiǎn)涓涓?code>Alias 錛屽垯鍙兘闇瑕佹槑紜殑瀵圭洰鏍囩洰褰曡瀹氳闂潈闄愩?/p>
紺轟緥錛?/h3>
Alias /image /ftp/pub/image
<Directory /ftp/pub/image>
Order allow,deny
Allow from all
</Directory>
聽1
<
IfModule聽
alias_module
>
聽2
聽聽聽聽#
聽3
聽聽聽聽#聽Redirect:聽Allows聽you聽to聽tell聽clients聽about聽documents聽that聽used聽to聽
聽4
聽聽聽聽#聽exist聽in聽your聽server's聽namespace,聽but聽do聽not聽anymore.聽The聽client聽
聽5
聽聽聽聽#聽will聽make聽a聽new聽request聽for聽the聽document聽at聽its聽new聽location.
聽6
聽聽聽聽#聽Example:
聽7
聽聽聽聽#聽Redirect聽permanent聽/foo聽http://test.piao.net/bar
聽8
聽9
聽聽聽聽#
10
聽聽聽聽#聽Alias:聽Maps聽web聽paths聽into聽filesystem聽paths聽and聽is聽used聽to
11
聽聽聽聽#聽access聽content聽that聽does聽not聽live聽under聽the聽DocumentRoot.
12
聽聽聽聽#聽Example:
13
聽聽聽聽#聽Alias聽/webpath聽/full/filesystem/path
14
聽聽聽聽Alias聽/THINKPHP聽聽聽D:/ThinkPHP聽
15
聽聽聽聽#
16
聽聽聽聽#聽I(yíng)f聽you聽include聽a聽trailing聽/聽on聽/webpath聽then聽the聽server聽will
17
聽聽聽聽#聽require聽it聽to聽be聽present聽in聽the聽URL.聽聽You聽will聽also聽likely
18
聽聽聽聽#聽need聽to聽provide聽a聽
<
Directory
>
聽section聽to聽allow聽access聽to
19
聽聽聽聽#聽the聽filesystem聽path.
20
21
聽聽聽聽#
22
聽聽聽聽#聽ScriptAlias:聽This聽controls聽which聽directories聽contain聽server聽scripts.聽
23
聽聽聽聽#聽ScriptAliases聽are聽essentially聽the聽same聽as聽Aliases,聽except聽that
24
聽聽聽聽#聽documents聽in聽the聽target聽directory聽are聽treated聽as聽applications聽and
25
聽聽聽聽#聽run聽by聽the聽server聽when聽requested聽rather聽than聽as聽documents聽sent聽to聽the
26
聽聽聽聽#聽client.聽聽The聽same聽rules聽about聽trailing聽"/"聽apply聽to聽ScriptAlias
27
聽聽聽聽#聽directives聽as聽to聽Alias.
28
聽聽聽聽#
29
聽聽聽聽ScriptAlias聽/cgi-bin/聽"D:/Program聽Files/Apache2.2/cgi-bin/"
30
31
</
IfModule
>
聽1
#
聽2
#聽"D:/Program聽Files/Apache2.2/cgi-bin"聽should聽be聽changed聽to聽whatever聽your聽ScriptAliased
聽3
#聽CGI聽directory聽exists,聽if聽you聽have聽that聽configured.
聽4
#
聽5
<
Directory聽
"D:/Program聽Files/Apache2.2/cgi-bin"
>
聽6
聽聽聽聽AllowOverride聽None
聽7
聽聽聽聽Options聽None
聽8
聽聽聽聽Order聽allow,deny
聽9
聽聽聽聽Allow聽from聽all
10
</
Directory
>
11
12
<
Directory聽
"D:/ThinkPHP"
>
13
聽聽聽聽AllowOverride聽None
14
聽聽聽聽Options聽None
15
聽聽聽聽Order聽allow,deny
16
聽聽聽聽Allow聽from聽all
17
</
Directory
>
18
#

]]>