home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / apache_2.2.8-win32-x86-no_ssl.msi / Data1.cab / _2FCCED8FC825E98F34F615AF46B20975 < prev    next >
Extensible Markup Language  |  2007-11-14  |  28KB  |  479 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
  4.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  5.               This file is generated from xml source: DO NOT EDIT
  6.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  7.       -->
  8. <title>Configuration Sections - Apache HTTP Server</title>
  9. <link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
  10. <link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
  11. <link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
  12. <link href="./images/favicon.ico" rel="shortcut icon" /></head>
  13. <body id="manual-page"><div id="page-header">
  14. <p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p>
  15. <p class="apache">Apache HTTP Server Version 2.2</p>
  16. <img alt="" src="./images/feather.gif" /></div>
  17. <div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div>
  18. <div id="path">
  19. <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="./">Version 2.2</a></div><div id="page-content"><div id="preamble"><h1>Configuration Sections</h1>
  20. <div class="toplang">
  21. <p><span>Available Languages: </span><a href="./en/sections.html" title="English"> en </a> |
  22. <a href="./fr/sections.html" hreflang="fr" rel="alternate" title="Franτais"> fr </a> |
  23. <a href="./ja/sections.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
  24. <a href="./ko/sections.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
  25. </div>
  26.  <p>Directives in the <a href="configuring.html">configuration files</a> may apply to the
  27. entire server, or they may be restricted to apply only to particular
  28. directories, files, hosts, or URLs.  This document describes how to
  29. use configuration section containers or <code>.htaccess</code> files
  30. to change the scope of other configuration directives.</p>
  31. </div>
  32. <div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#types">Types of Configuration Section Containers</a></li>
  33. <li><img alt="" src="./images/down.gif" /> <a href="#file-and-web">Filesystem and Webspace</a></li>
  34. <li><img alt="" src="./images/down.gif" /> <a href="#virtualhost">Virtual Hosts</a></li>
  35. <li><img alt="" src="./images/down.gif" /> <a href="#proxy">Proxy</a></li>
  36. <li><img alt="" src="./images/down.gif" /> <a href="#whatwhere">What Directives are Allowed?</a></li>
  37. <li><img alt="" src="./images/down.gif" /> <a href="#mergin">How the sections are merged</a></li>
  38. </ul></div>
  39. <div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
  40. <div class="section">
  41. <h2><a name="types" id="types">Types of Configuration Section Containers</a></h2>
  42.  
  43. <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/core.html">core</a></code></li><li><code class="module"><a href="./mod/mod_version.html">mod_version</a></code></li><li><code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/core.html#directory"><Directory></a></code></li><li><code class="directive"><a href="./mod/core.html#directorymatch"><DirectoryMatch></a></code></li><li><code class="directive"><a href="./mod/core.html#files"><Files></a></code></li><li><code class="directive"><a href="./mod/core.html#filesmatch"><FilesMatch></a></code></li><li><code class="directive"><a href="./mod/core.html#ifdefine"><IfDefine></a></code></li><li><code class="directive"><a href="./mod/core.html#ifmodule"><IfModule></a></code></li><li><code class="directive"><a href="./mod/mod_version.html#ifversion"><IfVersion></a></code></li><li><code class="directive"><a href="./mod/core.html#location"><Location></a></code></li><li><code class="directive"><a href="./mod/core.html#locationmatch"><LocationMatch></a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxy"><Proxy></a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxymatch"><ProxyMatch></a></code></li><li><code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code></li></ul></td></tr></table>
  44.  
  45. <p>There are two basic types of containers.  Most containers are
  46. evaluated for each request.  The enclosed directives are applied only
  47. for those requests that match the containers.  The <code class="directive"><a href="./mod/core.html#ifdefine"><IfDefine></a></code>, <code class="directive"><a href="./mod/core.html#ifmodule"><IfModule></a></code>, and
  48. <code class="directive"><a href="./mod/mod_version.html#ifversion"><IfVersion></a></code>
  49. containers, on the other hand, are evaluated only at server startup
  50. and restart.  If their conditions are true at startup, then the
  51. enclosed directives will apply to all requests.  If the conditions are
  52. not true, the enclosed directives will be ignored.</p>
  53.  
  54. <p>The <code class="directive"><a href="./mod/core.html#ifdefine"><IfDefine></a></code> directive
  55. encloses directives that will only be applied if an appropriate
  56. parameter is defined on the <code class="program"><a href="./programs/httpd.html">httpd</a></code> command line.  For example,
  57. with the following configuration, all requests will be redirected
  58. to another site only if the server is started using
  59. <code>httpd -DClosedForNow</code>:</p>
  60.  
  61. <div class="example"><p><code>
  62. <IfDefine ClosedForNow><br />
  63. Redirect / http://otherserver.example.com/<br />
  64. </IfDefine>
  65. </code></p></div>
  66.  
  67. <p>The <code class="directive"><a href="./mod/core.html#ifmodule"><IfModule></a></code>
  68. directive is very similar, except it encloses directives that will
  69. only be applied if a particular module is available in the server.
  70. The module must either be statically compiled in the server, or it
  71. must be dynamically compiled and its <code class="directive"><a href="./mod/mod_so.html#loadmodule">LoadModule</a></code> line must be earlier in the
  72. configuration file.  This directive should only be used if you need
  73. your configuration file to work whether or not certain modules are
  74. installed.  It should not be used to enclose directives that you want
  75. to work all the time, because it can suppress useful error messages
  76. about missing modules.</p>
  77.  
  78. <p>In the following example, the <code class="directive"><a href="./mod/mod_mime_magic.html#mimemagicfiles">MimeMagicFiles</a></code> directive will be
  79. applied only if <code class="module"><a href="./mod/mod_mime_magic.html">mod_mime_magic</a></code> is available.</p>
  80.  
  81. <div class="example"><p><code>
  82. <IfModule mod_mime_magic.c><br />
  83. MimeMagicFile conf/magic<br />
  84. </IfModule>
  85. </code></p></div>
  86.  
  87. <p>The <code class="directive"><a href="./mod/mod_version.html#ifversion"><IfVersion></a></code>
  88. directive is very similar to <code class="directive"><a href="./mod/core.html#ifdefine"><IfDefine></a></code> and <code class="directive"><a href="./mod/core.html#ifmodule"><IfModule></a></code>, except it encloses directives that will
  89. only be applied if a particular version of the server is executing.  This
  90. module is designed for the use in test suites and large networks which have to
  91. deal with different httpd versions and different configurations.</p>
  92.  
  93. <div class="example"><p><code>
  94.   <IfVersion >= 2.1><br />
  95.   <span class="indent">
  96.     # this happens only in versions greater or<br />
  97.     # equal 2.1.0.<br />
  98.   </span>
  99.   </IfVersion>
  100. </code></p></div>
  101.  
  102. <p><code class="directive"><a href="./mod/core.html#ifdefine"><IfDefine></a></code>,
  103. <code class="directive"><a href="./mod/core.html#ifmodule"><IfModule></a></code>, and the
  104. <code class="directive"><a href="./mod/mod_version.html#ifversion"><IfVersion></a></code>
  105. can apply negative conditions by preceding their test with "!".
  106. Also, these sections can be nested to achieve more complex
  107. restrictions.</p>
  108. </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
  109. <div class="section">
  110. <h2><a name="file-and-web" id="file-and-web">Filesystem and Webspace</a></h2>
  111.  
  112. <p>The most commonly used configuration section containers are the
  113. ones that change the configuration of particular places in the
  114. filesystem or webspace.  First, it is important to understand the
  115. difference between the two.  The filesystem is the view of your disks
  116. as seen by your operating system.  For example, in a default install,
  117. Apache resides at <code>/usr/local/apache2</code> in the Unix
  118. filesystem or <code>"c:/Program Files/Apache Group/Apache2"</code> in
  119. the Windows filesystem.  (Note that forward slashes should always be
  120. used as the path separator in Apache, even for Windows.)  In contrast,
  121. the webspace is the view of your site as delivered by the web server
  122. and seen by the client.  So the path <code>/dir/</code> in the
  123. webspace corresponds to the path
  124. <code>/usr/local/apache2/htdocs/dir/</code> in the filesystem of a
  125. default Apache install on Unix.  The webspace need not map directly to
  126. the filesystem, since webpages may be generated dynamically
  127. from databases or other locations.</p>
  128.  
  129. <h3><a name="filesystem" id="filesystem">Filesystem Containers</a></h3>
  130.  
  131. <p>The <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code>
  132. and <code class="directive"><a href="./mod/core.html#files"><Files></a></code>
  133. directives, along with their <a class="glossarylink" href="./glossary.html#regex" title="see glossary">regex</a>
  134. counterparts, apply directives to
  135. parts of the filesystem.  Directives enclosed in a <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> section apply to
  136. the named filesystem directory and all subdirectories of that
  137. directory.  The same effect can be obtained using <a href="howto/htaccess.html">.htaccess files</a>.  For example, in the
  138. following configuration, directory indexes will be enabled for the
  139. <code>/var/web/dir1</code> directory and all subdirectories.</p>
  140.  
  141. <div class="example"><p><code>
  142. <Directory /var/web/dir1><br />
  143. Options +Indexes<br />
  144. </Directory>
  145. </code></p></div>
  146.  
  147. <p>Directives enclosed in a <code class="directive"><a href="./mod/core.html#files"><Files></a></code> section apply to any file with
  148. the specified name, regardless of what directory it lies in.
  149. So for example, the following configuration directives will,
  150. when placed in the main section of the configuration file,
  151. deny access to any file named <code>private.html</code> regardless
  152. of where it is found.</p>
  153.  
  154. <div class="example"><p><code>
  155. <Files private.html><br />
  156. Order allow,deny<br />
  157. Deny from all<br />
  158. </Files>
  159. </code></p></div>
  160.  
  161. <p>To address files found in a particular part of the filesystem, the
  162. <code class="directive"><a href="./mod/core.html#files"><Files></a></code> and
  163. <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> sections
  164. can be combined.  For example, the following configuration will deny
  165. access to <code>/var/web/dir1/private.html</code>,
  166. <code>/var/web/dir1/subdir2/private.html</code>,
  167. <code>/var/web/dir1/subdir3/private.html</code>, and any other instance
  168. of <code>private.html</code> found under the <code>/var/web/dir1/</code>
  169. directory.</p>
  170.  
  171. <div class="example"><p><code>
  172. <Directory /var/web/dir1><br />
  173. <Files private.html><br />
  174. Order allow,deny<br />
  175. Deny from all<br />
  176. </Files><br />
  177. </Directory>
  178. </code></p></div>
  179.  
  180.  
  181. <h3><a name="webspace" id="webspace">Webspace Containers</a></h3>
  182.  
  183. <p>The <code class="directive"><a href="./mod/core.html#location"><Location></a></code>
  184. directive and its <a class="glossarylink" href="./glossary.html#regex" title="see glossary">regex</a> counterpart, on the
  185. other hand, change the
  186. configuration for content in the webspace.  For example, the following
  187. configuration prevents access to any URL-path that begins in /private.
  188. In particular, it will apply to requests for
  189. <code>http://yoursite.example.com/private</code>,
  190. <code>http://yoursite.example.com/private123</code>, and
  191. <code>http://yoursite.example.com/private/dir/file.html</code> as well
  192. as any other requests starting with the <code>/private</code> string.</p>
  193.  
  194. <div class="example"><p><code>
  195. <Location /private><br />
  196. Order Allow,Deny<br />
  197. Deny from all<br />
  198. </Location>
  199. </code></p></div>
  200.  
  201. <p>The <code class="directive"><a href="./mod/core.html#location"><Location></a></code>
  202. directive need not have anything to do with the filesystem.
  203. For example, the following example shows how to map a particular
  204. URL to an internal Apache handler provided by <code class="module"><a href="./mod/mod_status.html">mod_status</a></code>.
  205. No file called <code>server-status</code> needs to exist in the
  206. filesystem.</p>
  207.  
  208. <div class="example"><p><code>
  209. <Location /server-status><br />
  210. SetHandler server-status<br />
  211. </Location>
  212. </code></p></div>
  213.  
  214.  
  215. <h3><a name="wildcards" id="wildcards">Wildcards and Regular Expressions</a></h3>
  216.  
  217. <p>The <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code>,
  218. <code class="directive"><a href="./mod/core.html#files"><Files></a></code>, and
  219. <code class="directive"><a href="./mod/core.html#location"><Location></a></code>
  220. directives can each use shell-style wildcard characters as in
  221. <code>fnmatch</code> from the C standard library.  The character "*"
  222. matches any sequence of characters, "?" matches any single character,
  223. and "[<em>seq</em>]" matches any character in <em>seq</em>.  The "/"
  224. character will not be matched by any wildcard; it must be specified
  225. explicitly.</p>
  226.  
  227. <p>If even more flexible matching is required, each
  228. container has a regular expression (regex) counterpart <code class="directive"><a href="./mod/core.html#directorymatch"><DirectoryMatch></a></code>, <code class="directive"><a href="./mod/core.html#filesmatch"><FilesMatch></a></code>, and <code class="directive"><a href="./mod/core.html#locationmatch"><LocationMatch></a></code> that allow
  229. perl-compatible
  230. <a class="glossarylink" href="./glossary.html#regex" title="see glossary">regular expressions</a>
  231. to be used in choosing the matches.  But see the section below on
  232. configuration merging to find out how using regex sections will change
  233. how directives are applied.</p>
  234.  
  235. <p>A non-regex wildcard section that changes the configuration of
  236. all user directories could look as follows:</p>
  237.  
  238. <div class="example"><p><code>
  239. <Directory /home/*/public_html><br />
  240. Options Indexes<br />
  241. </Directory>
  242. </code></p></div>
  243.  
  244. <p>Using regex sections, we can deny access to many types of image files
  245. at once:</p>
  246. <div class="example"><p><code>
  247. <FilesMatch \.(?i:gif|jpe?g|png)$><br />
  248. Order allow,deny<br />
  249. Deny from all<br />
  250. </FilesMatch>
  251. </code></p></div>
  252.  
  253.  
  254.  
  255. <h3><a name="whichwhen" id="whichwhen">What to use When</a></h3>
  256.  
  257. <p>Choosing between filesystem containers and webspace containers is
  258. actually quite easy.  When applying directives to objects that reside
  259. in the filesystem always use <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> or <code class="directive"><a href="./mod/core.html#files"><Files></a></code>.  When applying directives to objects
  260. that do not reside in the filesystem (such as a webpage generated from
  261. a database), use <code class="directive"><a href="./mod/core.html#location"><Location></a></code>.</p>
  262.  
  263. <p>It is important to never use <code class="directive"><a href="./mod/core.html#location"><Location></a></code> when trying to restrict
  264. access to objects in the filesystem.  This is because many
  265. different webspace locations (URLs) could map to the same filesystem
  266. location, allowing your restrictions to be circumvented.
  267. For example, consider the following configuration:</p>
  268.  
  269. <div class="example"><p><code>
  270. <Location /dir/><br />
  271. Order allow,deny<br />
  272. Deny from all<br />
  273. </Location>
  274. </code></p></div>
  275.  
  276. <p>This works fine if the request is for
  277. <code>http://yoursite.example.com/dir/</code>.  But what if you are on
  278. a case-insensitive filesystem?  Then your restriction could be easily
  279. circumvented by requesting
  280. <code>http://yoursite.example.com/DIR/</code>.  The <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> directive, in
  281. contrast, will apply to any content served from that location,
  282. regardless of how it is called.  (An exception is filesystem links.
  283. The same directory can be placed in more than one part of the
  284. filesystem using symbolic links.  The <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> directive will follow the symbolic
  285. link without resetting the pathname.  Therefore, for the highest level
  286. of security, symbolic links should be disabled with the appropriate
  287. <code class="directive"><a href="./mod/core.html#options">Options</a></code> directive.)</p>
  288.  
  289. <p>If you are, perhaps, thinking that none of this applies to you
  290. because you use a case-sensitive filesystem, remember that there are
  291. many other ways to map multiple webspace locations to the same
  292. filesystem location.  Therefore you should always use the filesystem
  293. containers when you can.  There is, however, one exception to this
  294. rule.  Putting configuration restrictions in a <code><Location
  295. /></code> section is perfectly safe because this section will apply
  296. to all requests regardless of the specific URL.</p>
  297.  
  298.  
  299. </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
  300. <div class="section">
  301. <h2><a name="virtualhost" id="virtualhost">Virtual Hosts</a></h2>
  302.  
  303. <p>The <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code>
  304. container encloses directives that apply to specific hosts.
  305. This is useful when serving multiple hosts from the same machine
  306. with a different configuration for each.  For more information,
  307. see the <a href="vhosts/">Virtual Host Documentation</a>.</p>
  308. </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
  309. <div class="section">
  310. <h2><a name="proxy" id="proxy">Proxy</a></h2>
  311.  
  312. <p>The <code class="directive"><a href="./mod/mod_proxy.html#proxy"><Proxy></a></code>
  313. and <code class="directive"><a href="./mod/mod_proxy.html#proxymatch"><ProxyMatch></a></code>
  314. containers apply enclosed configuration directives only
  315. to sites accessed through <code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code>'s proxy server
  316. that match the specified URL.  For example, the following configuration
  317. will prevent the proxy server from being used to access the
  318. <code>cnn.com</code> website.</p>
  319.  
  320. <div class="example"><p><code>
  321. <Proxy http://cnn.com/*><br />
  322. Order allow,deny<br />
  323. Deny from all<br />
  324. </Proxy>
  325. </code></p></div>
  326. </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
  327. <div class="section">
  328. <h2><a name="whatwhere" id="whatwhere">What Directives are Allowed?</a></h2>
  329.  
  330. <p>To find out what directives are allowed in what types of
  331. configuration sections, check the <a href="mod/directive-dict.html#Context">Context</a> of the directive.
  332. Everything that is allowed in 
  333. <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code>
  334. sections is also syntactically allowed in
  335. <code class="directive"><a href="./mod/core.html#directorymatch"><DirectoryMatch></a></code>,
  336. <code class="directive"><a href="./mod/core.html#files"><Files></a></code>,
  337. <code class="directive"><a href="./mod/core.html#filesmatch"><FilesMatch></a></code>,
  338. <code class="directive"><a href="./mod/core.html#location"><Location></a></code>,
  339. <code class="directive"><a href="./mod/core.html#locationmatch"><LocationMatch></a></code>,
  340. <code class="directive"><a href="./mod/mod_proxy.html#proxy"><Proxy></a></code>,
  341. and <code class="directive"><a href="./mod/mod_proxy.html#proxymatch"><ProxyMatch></a></code>
  342. sections.  There are some exceptions, however:</p>
  343.  
  344. <ul>
  345. <li>The <code class="directive"><a href="./mod/core.html#allowoverride">AllowOverride</a></code> directive
  346. works only in <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code>
  347. sections.</li>
  348.  
  349. <li>The <code>FollowSymLinks</code> and
  350. <code>SymLinksIfOwnerMatch</code> <code class="directive"><a href="./mod/core.html#options">Options</a></code> work only in <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> sections or
  351. <code>.htaccess</code> files.</li>
  352.  
  353. <li>The <code class="directive"><a href="./mod/core.html#options">Options</a></code> directive cannot
  354. be used in <code class="directive"><a href="./mod/core.html#files"><Files></a></code>
  355. and <code class="directive"><a href="./mod/core.html#filesmatch"><FilesMatch></a></code>
  356. sections.</li>
  357. </ul>
  358. </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
  359. <div class="section">
  360. <h2><a name="mergin" id="mergin">How the sections are merged</a></h2>
  361.  
  362. <p>The configuration sections are applied in a very particular order.
  363. Since this can have important effects on how configuration directives
  364. are interpreted, it is important to understand how this works.</p>
  365.  
  366.     <p>The order of merging is:</p>
  367.  
  368.     <ol>
  369.       <li> <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> (except regular expressions)
  370.       and <code>.htaccess</code> done simultaneously (with
  371.       <code>.htaccess</code>, if allowed, overriding
  372.       <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code>)</li>
  373.  
  374.       <li><code class="directive"><a href="./mod/core.html#directorymatch"><DirectoryMatch></a></code>
  375.       (and <code><Directory ~></code>)</li>
  376.  
  377.       <li><code class="directive"><a href="./mod/core.html#files"><Files></a></code> and <code class="directive"><a href="./mod/core.html#filesmatch"><FilesMatch></a></code> done
  378.       simultaneously</li>
  379.  
  380.       <li><code class="directive"><a href="./mod/core.html#location"><Location></a></code>
  381.       and <code class="directive"><a href="./mod/core.html#locationmatch"><LocationMatch></a></code> done simultaneously</li>
  382.     </ol>
  383.  
  384.     <p>Apart from <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code>, each group is processed in
  385.     the order that they appear in the configuration files.  <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> (group 1 above)
  386.     is processed in the order shortest directory component to longest.
  387.     So for example, <code><Directory /var/web/dir></code> will
  388.     be processed before <code><Directory
  389.     /var/web/dir/subdir></code>.  If multiple <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> sections apply
  390.     to the same directory they are processed in the configuration file
  391.     order. Configurations included via the <code class="directive"><a href="./mod/core.html#include">Include</a></code> directive will be treated as if
  392.     they were inside the including file at the location of the
  393.     <code class="directive"><a href="./mod/core.html#include">Include</a></code> directive.</p>
  394.  
  395.     <p>Sections inside <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> sections
  396.     are applied <em>after</em> the corresponding sections outside
  397.     the virtual host definition. This allows virtual hosts to
  398.     override the main server configuration.</p>
  399.  
  400.     <p>When the request is served by <code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code>, the
  401.     <code class="directive"><a href="./mod/mod_proxy.html#proxy"><Proxy></a></code>
  402.     container takes the place of the <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> container in the processing
  403.     order.</p>
  404.  
  405.     <p>Later sections override earlier ones.</p>
  406.  
  407. <div class="note"><h3>Technical Note</h3>
  408.       There is actually a
  409.       <code><Location></code>/<code><LocationMatch></code>
  410.       sequence performed just before the name translation phase
  411.       (where <code>Aliases</code> and <code>DocumentRoots</code>
  412.       are used to map URLs to filenames). The results of this
  413.       sequence are completely thrown away after the translation has
  414.       completed.
  415. </div>
  416.  
  417. <h3><a name="merge-examples" id="merge-examples">Some Examples</a></h3>
  418.  
  419. <p>Below is an artificial example to show the order of
  420. merging. Assuming they all apply to the request, the directives in
  421. this example will be applied in the order A > B > C > D >
  422. E.</p>
  423.  
  424. <div class="example"><p><code>
  425. <Location /><br />
  426. E<br />
  427. </Location><br />
  428. <br />
  429. <Files f.html><br />
  430. D<br />
  431. </Files><br />
  432. <br />
  433. <VirtualHost *><br />
  434. <Directory /a/b><br />
  435. B<br />
  436. </Directory><br />
  437. </VirtualHost><br />
  438. <br />
  439. <DirectoryMatch "^.*b$"><br />
  440. C<br />
  441. </DirectoryMatch><br />
  442. <br />
  443. <Directory /a/b><br />
  444. A<br />
  445. </Directory><br />
  446. <br />
  447. </code></p></div>
  448.  
  449. <p>For a more concrete example, consider the following.  Regardless of
  450. any access restrictions placed in <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code> sections, the <code class="directive"><a href="./mod/core.html#location"><Location></a></code> section will be
  451. evaluated last and will allow unrestricted access to the server.  In
  452. other words, order of merging is important, so be careful!</p>
  453.  
  454. <div class="example"><p><code>
  455. <Location /><br />
  456. Order deny,allow<br />
  457. Allow from all<br />
  458. </Location><br />
  459. <br />
  460. # Woops!  This <Directory> section will have no effect<br />
  461. <Directory /><br />
  462. Order allow,deny<br />
  463. Allow from all<br />
  464. Deny from badguy.example.com<br />
  465. </Directory>
  466. </code></p></div>
  467.  
  468.  
  469.  
  470. </div></div>
  471. <div class="bottomlang">
  472. <p><span>Available Languages: </span><a href="./en/sections.html" title="English"> en </a> |
  473. <a href="./fr/sections.html" hreflang="fr" rel="alternate" title="Franτais"> fr </a> |
  474. <a href="./ja/sections.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
  475. <a href="./ko/sections.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
  476. </div><div id="footer">
  477. <p class="apache">Copyright 2007 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
  478. <p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div>
  479. </body></html>