Alias configuration settings in apache

In some cases, we want to place our project folder outside of htdocs. This time Apache not understand that project and we can not run it in browser.

Apache provides alias configuration settings which will be placed in httpd.conf and we can run any app even deployed in out side of htdocs.

In my machine, I have installed xampp in Windows 7. I have created a folder “E:/test” and it contains “index.html”. Assume “test” is a one of the project directory which is placed in outside of htdocs. So In order to access E:/test/index.html,  we need to create alias configuration as follows in httpd.conf file and restart the server.

<Directory "E:/test">
  Order allow,deny
  Allow from all
  Require all granted
</Directory>
Alias /test "E:/test"

Now you can access the index.html by entering the URl

http://localhost/test/index.html  (you can add port in url if you have changed default port 80)

Leave a Reply

Your email address will not be published. Required fields are marked *