I get Access Forbidden (Error 403) when setting up new alias

Gazillion picture Gazillion · Dec 13, 2011 · Viewed 185.2k times · Source

I'm running windows 7 and recently installed XAMPP to build a dev environment. I'm not great with the server side of things so I'm having some problems setting up an alias for a project.

So far XAMPP is running and if I go to localhost I get the XAMPP welcome page. I created an "alias" folder in my "conf" folder of my apache install. In there I added dev.conf with the following content:

<Directory "C:\Users\my_user\My%20Documents\Aptana%20Studio%203%20Workspace\project">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from 127.0.0.1
</Directory>

Alias /dev "C:\Users\my_user\My%20Documents\Aptana%20Studio%203%20Workspace\project"

But then when I go to "localhost/dev" I get:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

I tried googling and I found other similar questions on SO but I can't seem to figure it out. Some say that you have to tell it to have permissions but in my conf file I specified to allow it from 127.0.0.1. Maybe this is because my path has spaces in it (though some googling told me %20 work). I had managed to create one to a different folder and copy pasted the working one and changed the alias and path and it broke so it this tells me it probably has something to do with either.

I looked in my log folder and found the following line:

[Tue Dec 13 14:59:20 2011] [error] [client ::1] client denied by server configuration: C:/Users/my_user/My%20Documents

I'm not sure if it cuts because error messages can only be of a certain length but that's definitely not the path I added in the dev.conf file, I'm hoping this can make this a bit clearer for some because I am getting pretty frustrated and I'm not sure what to try anymore.

Answer

GuyC picture GuyC · Nov 16, 2012

I just found the same issue with Aliases on a Windows install of Xampp.

To solve the 403 error:

<Directory "C:/Your/Directory/With/No/Trailing/Slash">
   Require all granted
</Directory>

Alias /dev "C:/Your/Directory/With/No/Trailing/Slash"

The default Xampp set up should be fine with just this. Some people have experienced issues with a deny placed on the root directory so flipping out the directory tag to:

<Directory "C:/Your/Directory/With/No/Trailing/Slash">
   Allow from all
   Require all granted
</Directory>

Would help with this but the current version of Xampp (v1.8.1 at the time of writing) doesn't require it.

As for op's issue with port 80 Xampp includes a handy Netstat button to discover what's using your ports. Fire that off and fix the conflict, I imagine it could have been IIS but can't be sure.