Difference between <Location> and <Directory> Apache directives

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.


Location can be used when using an AJP or proxy redirect. For example, Oracle's PLSQL APEX module uses the following URL: /pls/apex/f?p=1:1

If you try to restrict this using directory, it will never work since it's a pass-thru and not a physical directory on the server. Location works!