Apache: Alias directive for virtual directory returns HTTP Error 403

Hi,

I have added a virtual directory to an apache web server and the virtual directory is located outside the document root. I configured the httpd.conf how it is decripted in the apache doc

When I access the virtual directory an error “Access forbidden! Error 403” occured. The config seems to ok:

Alias /virtualdirectory/ "D:/user/www/virtual/"
<Directory "D:/user/www/virtual/">
   Options Indexes FollowSymLinks MultiViews ExecCGI
   AllowOverride All
   Order allow,deny
   Allow from all
</Directory>

Solution:

The default apache configration is very restrictive. It do not allow to access directories without authentication. This is defined in the Directory section of httpd.conf:


<Directory>
   AllowOverride none
   Require all denied
</Directory>

Add a “require all granted” directive to your virtual directory section will grant the access.

Alias /virtualdirectory/ "D:/user/www/virtual/"
<Directory "D:/user/www/virtual/">
   Options Indexes FollowSymLinks MultiViews ExecCGI
   AllowOverride All
   Order allow,deny
   Allow from all
   Require all granted
</Directory>
Advertisment to support michlstechblog.info

7 thoughts on “Apache: Alias directive for virtual directory returns HTTP Error 403”

  1. Great!! Thanks. This solved my problem!!! I was just using “Allow from all”. But “Require all granted” is also needed.

  2. This worked for me after a long battle and search. I was doing the same as Juan. Needed the extra require all granted. Thank you.

  3. I know that this is an old post but to clarify,

    Order allow,deny
    Allow from all

    is Apache 2.2, while

    AllowOverride All
    Require all granted

    is Apache 2.4 and they are never used together. It’s one or the other but not both!

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.