Skip to content
Advertisement

Wamp : You don’t have permission to access file.html on this server

I tried to create a virtualhost to access to my local website using wampserver, but i get a 403 Forbidden when i’m trying to access to the webpage :

I put the following line in my browser :

mywebsite/html/start.html

enter image description here

Here is the content of my httpd-vhost file :

<VirtualHost *:80>
    ServerName mywebsite
    DocumentRoot "D:pathToMySite"
    <Directory "D:pathToMySite">
        AllowOverride All
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

I put the alias also in my host file :

127.0.0.1    mywebsite

Advertisement

Answer

I will share my httpd.conf for AMPPS under windows(should be very similar to wamp)

<VirtualHost 127.0.0.1:80>
    <Directory "{$path}/www">
        Options FollowSymLinks Indexes
        AllowOverride All
        Order deny,allow
        allow from All
    </Directory>
    ServerName localhost
    ServerAlias localhost 127.0.0.1
    ScriptAlias /cgi-bin/ "{$path}/www/cgi-bin/"
    DocumentRoot "{$path}/www"
    ErrorLog "{$path}/apache/logs/error.log"
    CustomLog "{$path}/apache/logs/access.log" combined
</VirtualHost>

<VirtualHost *:80>
    <Directory "F:/www">
        Options FollowSymLinks Indexes
        AllowOverride All
        Order deny,allow
        allow from All
    </Directory>
    DocumentRoot "F:/www"
    ServerName site1.com
</VirtualHost>

I also use host file for local DNS

127.0.0.1    site1.com

hope that helps !

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement