Search code examples
wampwampserver

you don't have permission to access [custom alias] on this server


can anyone help with a following issue: I am using wamp to run projects in my chrome browser. after adding a newAlias which points to my project directory c:/dev/myProject I am getting Forbidden message: you don't have permission to access /newAlias on this server. I can access default Aliases such as phpmyadmin, webgrind... but i cannot access my own. I am using WampServer Version 2.5 64bit on Win 8.1 64bit located in c:/wamp. I tried basic stuff from the net but with no luck. Any suggestions?

Edit: content of newAlias:

Alias /bs1/ "c:/_DEV_/git/NewProject/www/" 

<Directory "c:/_DEV_/git/NewProject/www/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
</Directory>

Solution

  • Dont change that section of your httpd.conf. Those few lines control access to the root folder of the drive that Apache is installed on. So you just gave full access to anybody with a handy hack.

    The process of securing the access via Apache is to deny all access to everything from the root folder and below, and then selectively allow access for specific sites to specific areas/folders of the drive.

    A better solution would be to change httpd.conf back to how it was and make the change in your Alias definition. Like this :-

    Alias /bs1 "c:/_DEV_/git/NewProject/www/" 
    
    <Directory "c:/_DEV_/git/NewProject/www/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Require local          # <-- to develop on this PC
        Require ip 192.168.1   # <-- to access server from another PC on your network
        Require all granted    # <-- to allow the world to see the beauty of your site
    </Directory>
    

    It is actually a better idea to use Virtual Hosts to control each site and not Alias's.

    Here is a why and Howto :- WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts