Alias Directive
| Description: | Maps URLs to filesystem locations |
|---|---|
| Syntax: | Alias URL-path file-path|directory-path |
| Context: | server config, virtual host |
| Status: | Base |
| Module: | mod_alias |
The Alias directive allows documents to be stored in the local filesystem other than under the DocumentRoot. URLs with a (%-decoded) path beginning with url-path will be mapped to local files beginning with directory-path.
Example:
Alias /image /ftp/pub/image
A request for http://myserver/image/foo.gif would cause the server to return the file /ftp/pub/image/foo.gif.
Note that if you include a trailing / on the url-path then the server will require a trailing / in order to expand the alias. That is, if you use Alias /icons/ /usr/local/apache/icons/ then the url /icons will not be aliased.
Note that you may need to specify additional <Directory> sections which cover the destination of aliases. Aliasing occurs before <Directory> sections are checked, so only the destination of aliases are affected. (Note however <Location> sections are run through once before aliases are performed, so they will apply.)
In particular, if you are creating an Alias to a directory outside of your DocumentRoot, you may need to explicitly permit access to the target directory.
Example:
Alias /image /ftp/pub/image
<Directory /ftp/pub/image>
Order allow,deny
Allow from all
</Directory>
博客介绍了 Alias Directive,它允许文档存储在本地文件系统特定位置,以 url - path 开头的 URL 路径会映射到以 directory - path 开头的本地文件。还给出使用示例,同时提醒使用时的注意事项,如路径末尾斜杠要求、需指定额外部分及明确目标目录访问权限等。
6807

被折叠的 条评论
为什么被折叠?



