Why this VirtualDocumentRoot setup returns 403 Access Forbidden

apache-2.4virtualhost

I have the setup my httpd-vhosts.conf with the following derectives:

UseCanonicalName Off

LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

<VirtualHost 192.168.1.100:80>
VirtualDocumentRoot "E:/Web Development Projects/%3/%2.1/%2+"

DirectoryIndex  index.php index.html index.htm default.html default.htm home.html default.php home.php
</VirtualHost>

<VirtualHost 192.168.1.100:443>
SSLEngine On
SSLCertificateFile "E:/Web Development Projects/SSL/apache.crt"
SSLCertificateKeyFile "E:/Web Development Projects/SSL/apache.key"

VirtualDocumentRoot "E:/Web Development Projects/%3/%2.1/%2+"

DirectoryIndex  index.php index.html index.htm default.html default.htm home.html default.php home.php
</VirtualHost>

But unfortunatelly my web local server returns a `403 Access forbidden" message.

Note, that this same configuration was installed on another machine and works fine.

Is there anything wrong with this setup ?

Can somebody to help me please ?

Note: My file structure is E:/Web Development Projects/tld/i/domain.tld/ where

  1. tld is my local Top Level Domain (dch)
  2. i is the domain name initial
  3. domain.tld is the project domain name

This allows me to have the following file system structure

E:\
    Web Development Projects\
        dch\
            a\
                a-project.dch\
                    Files
                another-project.dch\
                    Files
            \z
                z-project.dch\
                    Files

UPDATE #1

I just applyed the instructions from below, but still the Apache don't start.

Here is my httpd-vhosts.conf with the modifications:

UseCanonicalName Off

LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

<VirtualHost 192.168.1.100:80>
VirtualDocumentRoot "E:/Web Development Projects/%3/%2.1/%2+"

DirectoryIndex  index.php index.html index.htm default.html default.htm home.html default.php home.php

    <Directory "E:/Web Development Projects/">
        Order deny, allow
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost 192.168.1.100:443>
SSLEngine On
SSLCertificateFile "E:/Web Development Projects/SSL/apache.crt"
SSLCertificateKeyFile "E:/Web Development Projects/SSL/apache.key"

VirtualDocumentRoot "E:/Web Development Projects/%3/%2.1/%2+"

DirectoryIndex  index.php index.html index.htm default.html default.htm home.html default.php home.php
</VirtualHost>

But this is the server result:

Error: Apache shutdown unexpectedly.
This may be due to a blocked port, missing dependencies, 
improper privileges, a crash, or a shutdown by another method.
Press the Logs button to view error logs and check
the Windows Event Viewer for more clues
If you need more help, copy and post this
entire log window on the forums

Any further information please ?

Best Answer

Try adding acl in Virtualhost config, perhaps some global directive is denying the access:

<Directory "E:/Web Development Projects/">
Order deny, allow
Require all granted
</Directory>

If apache version <= 2.4 replace "Require all granted" by "Allow from all".

Hope it helps.