Creating virtual host aliases under Apache

Sometimes you want to create folder alias for your website like this: /images to be mapped to /home/your_account/public_html/images.

To do this, you need to edit Apache httpd.conf file which is located at /etc/httpd/conf

It is clever to put all aliases in one file in the same directory and name them aliases.conf and then only to reference this file from httpd.conf.

You will include aliases.conf in httpd.conf like this:

<IfModule mod_alias.c>
    Include /Applications/MAMP/conf/apache/alias
</IfModule>

You define alias in aliases.conf file like this:

Alias /images /home/your_account/public_html/images
<Directory "/home/your_account/public_html/images">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

You may also like