WAMP 403 Forbidden message on Windows 7

243,887

Solution 1

The access to your Apache server is forbidden from addresses other than 127.0.0.1 in httpd.conf (Apache's config file) :

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

The same goes for your PHPMyAdmin access, the config file is phpmyadmin.conf :

<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
</Directory>

You can set them to allow connections from all IP addresses like follows :

AllowOverride All
Order allow,deny
Allow from all

Solution 2

I found a simpler fix...

Although the icon was green WAMP still needs to be "Put Online" (last item of menu when left-clicking icon).

After that I had access as normal.

Solution 3

For me the inclusion of "Require local" helped to solve Error 403. The alias config file looks like this:

Alias /mytest/ "C:/mytest/" 

<Directory "C:/mytest/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
    Require local
</Directory>

Solution 4

The solution for changing the permissions in the httpd.conf will work if you are OK with providing access to the WAMP server from outside.

If you do not want to do that then all you have to do is tell windows that the "localhost" domain points to 127.0.0.1. You can do that by editing the hosts file in your system directory.

The file is placed at : C:\Windows\System32\drivers\etc\hosts

by default windows 7 ships with :

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

You have to un-comment the mapping for localhost:

# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost
#   ::1         localhost

Note: you will not be able to edit the hosts file as its a read-only file. To edit, you have to be the administrator, copy the file to some other location, edit it and then copy it back to the etc directory.

I do not recommend the change of the hosts file. Use the permissions of httpd.conf file. use the hosts file approach only if you do not want the server accessed from outside.

Solution 5

Try adding the following lines of code to the file httpd-vhosts.conf:

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:\wamp\www"
ServerName localhost
</VirtualHost>
Share:
243,887

Related videos on Youtube

Jake
Author by

Jake

# SOreadytohelp

Updated on January 10, 2020

Comments

  • Jake
    Jake over 4 years

    I have installed WAMP version 2.1 on my windows 7 machine. When i browse to localhost in my browser, the WAMP server page is visible.

    But when I browse to my IP in my browser, I get the message

    403 Forbidden: You don't have permission to access / on this server.

    Any suggestions?

    • shraysalvi
      shraysalvi over 12 years
      The access to your Apache server is forbidden from addresses other than 127.0.0.1 in httpd.conf (Apache's config file)
    • Jake
      Jake over 12 years
      I corrected that, now I am getting 403 Forbidden in my phpMyAdmin, any suggestions for that ?
    • shraysalvi
      shraysalvi over 12 years
      there is also a phpmyadmin.conf that contains directives for the 'localhost/phpmyadmin' alias
    • shabby
      shabby over 10 years
      if you're here for windows 8 chk this stackoverflow.com/questions/13945783/…
  • Jeremy
    Jeremy about 12 years
    This will certainly open up access from any IP address, but isnt that a little dangerous? The rule to allow 'from 127.0.0.1' should be enough to allow local access, if that is the main objective here, the 127.0.0.1 is basically a loop back to the network adaptor. If you type in the address bar 'http'://127.0.0.1:{portNumber}/{folderOrFileName}' it should work fine. This should work the same as using localhost, but I have found some browsers have issues with localhost for some reason.
  • Jeremy
    Jeremy about 12 years
    I couldnt format my address line in that last comment so there's an extra "'" in it just ignore that sorry if it confuses anyone.
  • meetar
    meetar almost 12 years
    Note: the file sets defaults which are then overridden one at a time afterward, so make sure these lines go after all of the overrides.
  • fast-reflexes
    fast-reflexes about 11 years
    I think this answer really addresses the important thing that's being asked, namely that when IPv6 is enabled, localhost resolves to an IPv6 address (::1) and which in turn means that the requesting address will also be an IPv6 address (also ::1) which is NOT the same as 127.0.0.1 which is the only address from which connections are allowed. Also, localhost resolves through the local DNS server by default (not the hosts) and it's just better-looking according to me to leave it that way and instead either disable IPv6 so that localhost resolves to 127.0.0.1 or change / include as above.
  • Plummer
    Plummer over 10 years
    Don't forget to "Restart All Services" from the WAMP system tray menu (or however you do it.)
  • Jonathan Lidbeck
    Jonathan Lidbeck over 9 years
    This worked for me as well, using Apache 2.4.9. Been looking for this a long time. Thanks!
  • Hammad Khan
    Hammad Khan almost 9 years
    Options Indexes FollowSymLinks MultiViews is required also
  • Squazz
    Squazz almost 9 years
    Any reason for added the "C:/mytest/" part? It doesn't seem to have any effect, and just leaving a / in the end as it is as standard seems to work just as well
  • ummahusla
    ummahusla over 8 years
    Actually, this should be flagged as an accepted answer. Thank you dude.
  • GPY
    GPY over 8 years
    This solution deserve an upvote because the config is updated when you actualy click on the put online button : forum.wampserver.com/read.php?1,119467,119546
  • Steve
    Steve over 8 years
    Thanks! This fixed it.
  • Rakesh
    Rakesh about 8 years
    For Apache version 2.4.x replace Require local with Require all granted in httpd.conf file inside <Directory "c:/wamp/www/"> tag then Restart all services
  • ewroman
    ewroman about 8 years
    just adding 'Allow from ::1' to "c:\wamp\alias\phpmyadmin.conf file" solved phpmyadmin 403 problem.
  • Osmar
    Osmar about 8 years
    This fixed it for me too. Though in my case I had to first "Put offline", then "Put online" and worked without any other changes to my config files! Thank you!!
  • Fusseldieb
    Fusseldieb over 7 years
    Actually, I began making all those things in the first, accepted answer. And it did not help. Then I saw this here, and I thought 'No way it can be this...', but, it was that and it worked.
  • Vahid
    Vahid over 7 years
    Supercalifragilisticexpialidocious!
  • Smart Du
    Smart Du over 7 years
    Thank you,@miltonb.
  • Lajos Mészáros
    Lajos Mészáros almost 7 years
    Make sure to check extra/https-vhosts.conf. It might also contain a Require local, but it will not get overwritten by setting wampserver online.
  • kmdsax
    kmdsax over 6 years
    This did the trick for me. Strange thing is that 2 other VirtualHosts (in httpd-vhosts.conf) don't have 'Require local' or 'Require all granted', and still work fine. ¯_(ツ)_/¯
  • Rakesh
    Rakesh over 6 years
    Better use 'Require all granted' in place of 'Require local' if you want to open your site on other devices of your local network
  • Rex the Strange
    Rex the Strange about 4 years
    Adding "Allow from all" did it for me.