host-ing.ru homepageТарифыКлиентамДилерамО насЗаказать

Apache 1.3 documentation
Access Control by URL
Apache 1.3 Dynamic Shared Object (DSO) support
Apache Content Negotiation
Apache Keep-Alive Support
Apache Multiple Log Files
Apache extra features
Apache module mod_foobar
Apache suEXEC Support
Apache suEXEC Support
Apache's Handler Use
Compiling Apache under UnixWare
Compiling and Installing Apache
Custom error responses
How Directory, Location and Files sections work
Installing Apache on TPF
Issues Regarding DNS and Apache
New features with Apache 1.1
New features with Apache 1.2
New features with Apache 1.3
PATH_INFO Changes in the CGI Environment
Server Pool Management
Setting which addresses and ports Apache uses
Source Re-organisation
Special Purpose Environment Variables
Starting Apache
Stopping and Restarting Apache
The Apache EBCDIC Port
The Apache TPF Port
Upgrading to 1.3 from 1.2
Using Apache with Microsoft Windows
Using Apache with Novell NetWare 5

How Directory, Location and Files sections work

The sections <Directory>, <Location> and <Files> can contain directives which only apply to specified directories, URLs or files respectively. Also htaccess files can be used inside a directory to apply directives to that directory. This document explains how these different sections differ and how they relate to each other when Apache decides which directives apply for a particular directory or request URL.

Directives allowed in the sections

Everything that is syntactically allowed in <Directory> is also allowed in <Location> (except a sub-<Files> section). Semantically however some things, and the most notable are AllowOverride and the two options FollowSymLinks and SymLinksIfOwnerMatch, make no sense in <Location>, <LocationMatch> or <DirectoryMatch>. The same for <Files> -- syntactically everything is fine, but semantically some things are different.

How the sections are merged

The order of merging is:
  1. <Directory> (except regular expressions) and .htaccess done simultaneously (with .htaccess overriding <Directory>)
  2. <DirectoryMatch>, and <Directory> with regular expressions
  3. <Files> and <FilesMatch> done simultaneously
  4. <Location> and <LocationMatch> done simultaneously
Apart from <Directory>, each group is processed in the order that they appear in the configuration files. <Directory> (group 1 above) is processed in the order shortest directory component to longest. If multiple <Directory> sections apply to the same directory they they are processed in the configuration file order. The configuration files are read in the order httpd.conf, srm.conf and access.conf. Configurations included via the Include directive will be treated as if they where inside the including file at the location of the Include directive.

Sections inside <VirtualHost> sections are applied after the corresponding sections outside the virtual host definition. This allows virtual hosts to override the main server configuration. (Note: this only works correctly from 1.2.2 and 1.3a2 onwards. Before those releases sections inside virtual hosts were applied before the main server).

Notes about using sections

The general guidelines are:

  • If you are attempting to match objects at the filesystem level then you must use <Directory> and/or <Files>.
  • If you are attempting to match objects at the URL level then you must use <Location>
But a notable exception is:
  • proxy control is done via <Directory>. This is a legacy mistake because the proxy existed prior to <Location>. A future version of the config language should probably switch this to <Location>.

Note about .htaccess parsing:

  • Modifying .htaccess parsing during Location doesn't do anything because .htaccess parsing has already occurred.

<Location> and symbolic links:

  • It is not possible to use "Options FollowSymLinks" or "Options SymLinksIfOwnerMatch" inside a <Location>, <LocationMatch> or <DirectoryMatch> section (the options are simply ignored). Using the options in question is only possible inside a <Directory> section (or a .htaccess file).

<Files> and Options:

  • Apache won't check for it, but using an Options directive inside a <Files> section has no effect.

Another note:

  • There is actually a <Location>/<LocationMatch> sequence performed just before the name translation phase (where Aliases and DocumentRoots are used to map URLs to filenames). The results of this sequence are completely thrown away after the translation has completed.
Специальные ссылки См. также
  • Создание и редизайн сайта

  • Вакансии

  • Разное - полезное

  • Архив новостей

  • Задать вопрос

  • Вопросы и ответы

  • Версия для печати
    HomepageРазведкаПлан-карта местности

    Copyright © 2000-2017 HOST-ING.RU
    E-mail: info@host-ing.ru
    Контактная информация

    Сайт создан студией
    RealDesign

    RealDesign
    Наверх