Mapping URLs to Files with Alias


Alias /icons/ /usr/local/apache2/icons/


The structure of your website does not need to match the layout of your files on disk. You can use the Alias directive to map directories on disk to specific URLs. For example, this directive will cause a request for http://www.example.com/icons/image.gif to make Apache look for the file in /usr/local/apache2/icons/ image.gif instead of under the default document root, in /usr/local/apache2/htdocs/icons/image.gif.

The trailing slashes in the Alias directive are significant. If you include them, the client request must include the slash as well or the Alias directive won't take effect. For example, if you use the following directive

Alias /icons/ /usr/local/apache2/icons/


and request http://www.example.com/icons, the server will return a 404 Document Not Found error response.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net