php - 127.0.0.1 not working on wamp server

I have installed WAMP in my system and http://localhost is working nicely.

but when i got 127.0.0.1 then it gives Forbidden error:

Forbidden

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

I don't know what is this error for

in httpd.config i have give permission to allow all:

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

and if i set in my host file

127.0.0.1  localhost
127.0.0.1  test

and access test it gives same error. Any suggestion would be appreciated.thanks

1 Answer

  1. Edwin- Reply

    2020-02-13

    The correct syntax for Apache 2.4.x is

    <Directory "c:/wamp/www/">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>
    

    Now if you did not actually want to give access to your site while you develop it to the whole internet a better method would be

    <Directory "c:/wamp/www/">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require local
    </Directory>
    

    The require local covers localhost, 127.0.0.1 and ::1. ::1 is the IPV6 equivalent of 127.0.0.1

    If you want to be able to access the WAMPServer (Apache) from other PC's on your local network then you can include this line as well

    <Directory "c:/wamp/www/">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require local
        Require ip 192.168.0
    </Directory>
    

    Note: I used only the first 3 quartiles of the normal 4 quartile set, this gives access to any ip on your internal subnet.

    You will have to check what your actual subnet is as 192.168.0.x is a default but not for all home routers.

    Can i suggest you read this document and make the required fixes for the WAMPServer 2.4 release. Make each change one by one and make sure that Apache and MySQL start again after each change so you can know where you make any mistakes, as they happen, rather than doing them all in one go!

Leave a Reply

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

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>