Directory and Location Directives
Directory
| Description | Define a block of directives to apply to a directory tree |
| Synopsis
|
<Directory directoryPath>
... </Directory |
| Context | Default server, Virtual host
|
| Example
|
<Directory /var/www/acme>
AuthType Digest AuthName "Acme Inc." Require valid-user </Directory> |
Inside the directory block, you may use any directive that supports a Directory context. You may not nest Directory directives inside other Directory blocks. But you may use Directory blocks inside VirtualHost blocks.
The difference between the Directory and Location directives is that while the Directory directive applies to files in the file system, the Location directive applies to the URLs before they are mapped to file names.
DirectoryIndex
| Description | Define the default index file to serve for directory requests |
| Synopsis
|
DirectoryIndex document |
| Context | Default Server, Virtual host, Directory
|
| Example
|
DirectoryIndex index.php |
For example: if a DirectoryIndex of "index.php" is specified and a user requestes http://www.acme.com/products/. Then the document /products/index.php will be returned to the user.
NOTE: Unlike Apache, only one document may be specified in the DirectoryIndex directive. Also, only one DirectoryIndex directive may appear per context.
Location
| Description | Define a block of directives to apply to a URL |
| Synopsis | <Location URL>
... </Location> |
| Context | Default server, VirtualHost
|
| Example
|
<Location /admin/debug>
AddHandler myDebugHandler </Location> |
The main difference between the Directory and Location directives is that while the Directory directive applies to files in the file system, the Location directive applies to the URLs before they are mapped to file names.