location.html revision bf3d9f591e5af24fdcaa9029094dc045878d1d1a
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<HTML>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<HEAD>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<TITLE>Access Control by URL</TITLE>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen</HEAD>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<BODY
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen BGCOLOR="#FFFFFF"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen TEXT="#000000"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen LINK="#0000FF"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen VLINK="#000080"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen ALINK="#FF0000"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<!--#include virtual="header.html" -->
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<H1 ALIGN="CENTER">Access Control by URL</H1>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<h2><a name="location">The <code>&lt;Location&gt;</code> Directive</a></h2>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<strong>Syntax:</strong> &lt;Location <em>URL prefix</em>&gt;<br>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<strong>Context:</strong> server config, virtual host<br>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<strong>Status:</strong> core<br>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<p>The &lt;Location&gt; directive provides for access control by
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo SirainenURL. It is comparable to the <a
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenhref="mod/core.html#directory">&lt;Directory&gt;</a> directive, and
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenshould be matched with a &lt;/Location&gt; directive. Directives that
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenapply to the URL given should be listen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenwithin. <code>&lt;Location&gt;</code> sections are processed in the
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenorder they appear in the configuration file, after the
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen&lt;Directory&gt; sections and <code>.htaccess</code> files are
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenread.</p>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<p>Note that, due to the way HTTP functions, <em>URL prefix</em>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenshould, save for proxy requests, be of the form <code>/path/</code>,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenand should not include the <code>http://servername</code>. It doesn't
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainennecessarily have to protect a directory (it can be an individual
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenfile, or a number of files), and can include wild-cards. In a wild-card
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenstring, `?' matches any single character, and `*' matches any
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainensequences of characters.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<p>This functionality is especially useful when combined with the
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<code><a href="mod/mod_mime.html#sethandler">SetHandler</a></code>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainendirective. For example, to enable status requests, but allow them only
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenfrom browsers at foo.com, you might use:
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<pre>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen &lt;Location /status&gt;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen SetHandler server-status
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen order deny,allow
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen deny from all
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen allow from .foo.com
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen &lt;/Location&gt;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen</pre>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen<!--#include virtual="footer.html" -->
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen</BODY>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen</HTML>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen