Apache Directives – Difference Between and

apache-2.2directoryhttpd.conf

I have Zend Server installed and noticed something like the following was added to my httpd.conf file:

<Location /ZendServer>
 Order Allow,Deny
 Allow from 127.0.0.1
</Location>

Alias /ZendServer "C:\Program Files\Zend\ZendServer\GUI\html"

<Directory "C:\Program Files\Zend\ZendServer\GUI\html">
 AllowOverride All
</Directory>

But I can't seem to understand the difference between Location and Directory. I changed to something like the following, which makes more sense to me, and it still works:

<Location /ZendServer>
 AllowOverride All
 Order Allow,Deny
 Allow from 127.0.0.1
</Location>

Alias /ZendServer "C:\Program Files\Zend\ZendServer\GUI\html"

Can I keep my changes or should I put it back the way it was?

Best Answer

Directory directive works only for filesystem objects (e.g. /var/www/mypage, C:\www\mypage), while Location directive works only for URLs (the part after your site domain name, e.g. www.mypage.com/mylocation).

The usage is straightforward - you would use Location if you need to fine tune access rights by an URL, and you would use Directory if you need to control access rights to a directory (and its subdirectories) in the filesystem.

Related Topic