WAMP 403 Forbidden message on Windows 7
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>
Related videos on Youtube
Comments
-
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 over 12 yearsThe access to your Apache server is forbidden from addresses other than
127.0.0.1
inhttpd.conf
(Apache's config file) -
Jake over 12 yearsI corrected that, now I am getting 403 Forbidden in my phpMyAdmin, any suggestions for that ?
-
shraysalvi over 12 yearsthere is also a
phpmyadmin.conf
that contains directives for the 'localhost/phpmyadmin' alias -
shabby over 10 yearsif you're here for windows 8 chk this stackoverflow.com/questions/13945783/…
-
-
Jeremy about 12 yearsThis 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 about 12 yearsI 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 almost 12 yearsNote: 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 about 11 yearsI 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 over 10 yearsDon't forget to "Restart All Services" from the WAMP system tray menu (or however you do it.)
-
Jonathan Lidbeck over 9 yearsThis worked for me as well, using Apache 2.4.9. Been looking for this a long time. Thanks!
-
Hammad Khan almost 9 years
Options Indexes FollowSymLinks MultiViews
is required also -
Squazz almost 9 yearsAny 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 over 8 yearsActually, this should be flagged as an accepted answer. Thank you dude.
-
GPY over 8 yearsThis 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 over 8 yearsThanks! This fixed it.
-
Rakesh about 8 yearsFor Apache version 2.4.x replace
Require local
withRequire all granted
in httpd.conf file inside<Directory "c:/wamp/www/">
tag then Restart all services -
ewroman about 8 yearsjust adding 'Allow from ::1' to "c:\wamp\alias\phpmyadmin.conf file" solved phpmyadmin 403 problem.
-
Osmar about 8 yearsThis 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 over 7 yearsActually, 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 over 7 yearsSupercalifragilisticexpialidocious!
-
Smart Du over 7 yearsThank you,@miltonb.
-
Lajos Mészáros almost 7 yearsMake 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 over 6 yearsThis 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 over 6 yearsBetter 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 about 4 yearsAdding "Allow from all" did it for me.