]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Enable regex support in mod_alias with AliasMatch, ScriptAliasMatch and
authorAlexei Kosut <akosut@apache.org>
Tue, 8 Jul 1997 04:45:24 +0000 (04:45 +0000)
committerAlexei Kosut <akosut@apache.org>
Tue, 8 Jul 1997 04:45:24 +0000 (04:45 +0000)
RedirectMatch directives.

New syntax for regex support in http_core: <DirectoryMatch>,
<FilesMatch>, <LocationMatch> sections.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@78559 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/core.html
docs/manual/mod/directives.html
docs/manual/mod/mod_alias.html

index d073f63c0fe4884396e5ef7c9733ef03b78cfba7..b469c1d447ded988afcc7ab5dd3bc0ed937b6c78 100644 (file)
@@ -31,10 +31,12 @@ always available.
 <li><A HREF="#clearmodulelist">ClearModuleList</A>
 <li><A HREF="#defaulttype">DefaultType</A>
 <li><A HREF="#directory">&lt;Directory&gt;</A>
+<li><A HREF="#directorymatch">&lt;DirectoryMatch&gt;</A>
 <li><A HREF="#documentroot">DocumentRoot</A>
 <li><A HREF="#errordocument">ErrorDocument</A>
 <li><A HREF="#errorlog">ErrorLog</A>
 <li><A HREF="#files">&lt;Files&gt;</A>
+<li><A HREF="#filesmatch">&lt;FilesMatch&gt;</A>
 <li><A HREF="#group">Group</A>
 <li><A HREF="#hostnamelookups">HostNameLookups</A>
 <li><A HREF="#identitycheck">IdentityCheck</A>
@@ -45,6 +47,7 @@ always available.
 <li><A HREF="#listen">Listen</A>
 <li><A HREF="#listenbacklog">ListenBacklog</A>
 <li><A HREF="#location">&lt;Location&gt;</A>
+<li><A HREF="#locationmatch">&lt;LocationMatch&gt;</A>
 <li><A HREF="#lockfile">LockFile</A>
 <li><A HREF="#maxclients">MaxClients</A>
 <li><A HREF="#maxkeepaliverequests">MaxKeepAliveRequests</a>
@@ -305,7 +308,9 @@ Extended regular expressions can also be used, with the addition of the
    &lt;Directory ~ &quot;^/www/.*/[0-9]{3}&quot;&gt;
 </pre>
 
-would match directories in /www/ that consisted of three numbers.<p>
+would match directories in /www/ that consisted of three numbers. In
+Apache 1.3 and later, it is reccomended to use
+<a href="#directorymatch">&lt;DirectoryMatch&gt;</a> instead.<p>
 
 <p>If multiple directory sections match the directory (or its parents) containing
 a document, then the directives are applied in the order of shortest match
@@ -357,6 +362,26 @@ may appear in any configuration file. &lt;Directory&gt; directives cannot
 nest, and cannot appear in a <A HREF="#limit">&lt;Limit&gt;</A> section.
 <p><hr>
 
+<h2><A name="directorymatch">&lt;DirectoryMatch&gt;</A></h2>
+<strong>Syntax:</strong> &lt;DirectoryMatch <em>regex</em>&gt; ... &lt;/DirectoryMatch&gt; <br>
+<strong>Context:</strong> server config, virtual host<br>
+<strong>Status:</strong> Core.<br>
+<strong>Compatibility:</strong> Available in Apache 1.3 and later
+
+<p>&lt;DirectoryMatch&gt; and &lt;/DirectoryMatch&gt; are used to enclose a group of
+directives which will apply only to the named directory and sub-directories
+of that directory, the same as <a
+href="#directory">&lt;Directory&gt;</a>. However, it takes as an
+argument a regular expression. For example:</p>
+
+<pre>
+   &lt;DirectoryMatch &quot;^/www/.*/[0-9]{3}&quot;&gt;
+</pre>
+
+<p>would match directories in /www/ that consisted of three numbers.</p>
+
+<hr>
+
 <h2><A NAME="documentroot">DocumentRoot directive</A></h2>
 <!--%plaintext &lt;?INDEX {\tt DocumentRoot} directive&gt; -->
 <strong>Syntax:</strong> DocumentRoot <em>directory-filename</em><br>
@@ -478,7 +503,9 @@ the <code>~</code> character. For example:</p>
    &lt;Files ~ &quot;\.(gif|jpe?g|png)$&quot;&gt;
 </pre>
 
-would match most common Internet graphics formats.
+would match most common Internet graphics formats. In Apache 1.3 and
+later, <a href="#filesmatch">&lt;FilesMatch&gt;</a> is perferred,
+however.
 
 <p>Note that unlike <a
 href="#directory"><code>&lt;Directory&gt;</code></a> and <a
@@ -491,6 +518,26 @@ the directory being applied will be prefixed automatically.
 
 <p> <hr>
 
+<h2><A name="filesmatch">&lt;FilesMatch&gt;</A></h2>
+<strong>Syntax:</strong> &lt;FilesMatch <em>regex</em>&gt;
+... &lt;/Files&gt;<br>
+<strong>Context:</strong> server config, virtual host, htaccess<br>
+<strong>Status:</strong> core<br>
+<strong>Compatibility:</strong> only available in Apache
+1.3 and above.<p>
+
+<p>The &lt;FilesMatch&gt; directive provides for access control by
+filename, just as the <a href="#files">&lt;Files&gt;</a> directive
+does. However, it accepts a regular expression. For example:</p>
+
+<pre>
+   &lt;FilesMatch &quot;\.(gif|jpe?g|png)$&quot;&gt;
+</pre>
+
+<p>would match most common Internet graphics formats.</p>
+
+<hr>
+
 <h2><A name="group">Group directive</A></h2>
 <!--%plaintext &lt;?INDEX {\tt Group} directive&gt; -->
 <strong>Syntax:</strong> Group <em>unix-group</em><br>
@@ -732,7 +779,8 @@ the
 </pre>
 
 <p>would match URLs that contained the substring "/extra/data" or
-"/special/data".</p>
+"/special/data". However, in Apache 1.3 and above, use of <a
+href="#locationmatch">&lt;LocationMatch&gt;</a> is perferred.</p>
 
 <p>The <code>Location</code> functionality is especially useful when
 combined with the <code><a
@@ -749,6 +797,29 @@ from browsers at foo.com, you might use:
 </pre>
 <hr>
 
+<h2><a name="locationmatch">&lt;LocationMatch&gt;</a></h2>
+
+<strong>Syntax:</strong> &lt;LocationMatch <em>regex</em>&gt;
+... &lt;/LocationMatch&gt;<br>
+<strong>Context:</strong> server config, virtual host<br>
+<strong>Status:</strong> core<br>
+<strong>Compatibility:</strong> Location is only available in Apache
+1.3 and later.<p>
+
+<p>The &lt;LocationMatch&gt; directive provides for access control by
+URL, in an identical manner to <a
+href="#location">&lt;Location&gt;</a>. However, it takes a regular
+expression as an argument instead of a simple string. For example:</p>
+
+<pre>
+   &lt;LocationMatch &quot;/(extra|special)/data&quot;&gt;
+</pre>
+
+<p>would match URLs that contained the substring "/extra/data" or
+"/special/data".</p>
+
+<hr>
+
 <H2><A NAME="lockfile">LockFile directive</A></H2>
 <strong>Syntax:</strong> LockFile <em>filename</em><BR>
 <strong>Default:</strong> <code>LockFile logs/accept.lock</code><BR>
index d65e005614781754c2431b42ce5f6fa30a792d57..3667159927c3ab17aa75939d62a5c842543c8bc2 100644 (file)
@@ -33,6 +33,7 @@
 <li><A HREF="mod_mime.html#addtype">AddType</A>
 <li><A HREF="mod_log_agent.html#agentlog">AgentLog</A>
 <li><A HREF="mod_alias.html#alias">Alias</A>
+<li><A HREF="mod_alias.html#aliasmatch">AliasMatch</A>
 <li><A HREF="mod_access.html#allow">allow</A>
 <li><A HREF="core.html#allowoverride">AllowOverride</A>
 <li><A HREF="mod_auth_anon.html#anonymous">Anonymous</A>
@@ -76,6 +77,7 @@
 <li><A HREF="core.html#defaulttype">DefaultType</A>
 <li><A HREF="mod_access.html#deny">deny</A>
 <li><A HREF="core.html#directory">&lt;Directory&gt;</A>
+<li><A HREF="core.html#directorymatch">&lt;DirectoryMatch&gt;</A>
 <li><A HREF="mod_dir.html#directoryindex">DirectoryIndex</A>
 <li><A HREF="core.html#documentroot">DocumentRoot</A>
 <li><A HREF="core.html#errordocument">ErrorDocument</A>
@@ -86,6 +88,7 @@
 <li><A HREF="mod_expires.html#expiresdefault">ExpiresDefault</A>
 <li><A HREF="mod_dir.html#fancyindexing">FancyIndexing</A>
 <li><A HREF="core.html#files">&lt;Files&gt;</A>
+<li><A HREF="core.html#filesmatch">&lt;FilesMatch&gt;</A>
 <li><A HREF="mod_mime.html#forcetype">ForceType</A>
 <li><A HREF="core.html#group">Group</A>
 <li><A HREF="mod_headers.html#header">Header</A>
 <li><A HREF="mod_dld.html#loadfile">LoadFile</A>
 <li><A HREF="mod_dld.html#loadmodule">LoadModule</A>
 <li><A HREF="core.html#location">&lt;Location&gt;</A>
+<li><A HREF="core.html#locationmatch">&lt;LocationMatch&gt;</A>
 <li><A HREF="core.html#lockfile">LockFile</A>
 <li><A HREF="mod_log_config.html#logformat">LogFormat</A>
 <li><A HREF="core.html#maxclients">MaxClients</A>
 <li><A HREF="mod_proxy.html#proxyrequests">ProxyRequests</A>
 <li><A HREF="mod_dir.html#readmename">ReadmeName</A>
 <li><A HREF="mod_alias.html#redirect">Redirect</A>
+<li><A HREF="mod_alias.html#redirectmatch">RedirectMatch</A>
 <li><A HREF="mod_alias.html#redirectperm">RedirectPermanent</A>
 <li><A HREF="mod_alias.html#redirecttemp">RedirectTemp</A>
 <li><A HREF="mod_log_referer.html#refererignore">RefererIgnore</A>
 <li><A HREF="core.html#scoreboardfile">ScoreBoardFile</A>
 <li><A HREF="mod_actions.html#script">Script</A>
 <li><A HREF="mod_alias.html#scriptalias">ScriptAlias</A>
+<li><A HREF="mod_alias.html#scriptaliasmatch">ScriptAliasMatch</A>
 <li><A HREF="mod_cgi.html#scriptlog">ScriptLog</A>
 <li><A HREF="mod_cgi.html#scriptlogbuffer">ScriptLogBuffer</A>
 <li><A HREF="mod_cgi.html#scriptloglength">ScriptLogLength</A>
index 445c5942f0492000156e7396533a108b93648681..484c2b8352f3cae2db9e138a0b1fd5aa92322da0 100644 (file)
@@ -24,10 +24,13 @@ host filesystem in the the document tree, and for URL redirection.
 <H2>Directives</H2>
 <UL>
 <li><A HREF="#alias">Alias</A>
+<li><A HREF="#aliasmatch">AliasMatch</A>
 <li><A HREF="#redirect">Redirect</A>
+<li><A HREF="#redirectmatch">RedirectMatch</A>
 <li><A HREF="#redirecttemp">RedirectTemp</A>
 <li><A HREF="#redirectperm">RedirectPermanent</A>
 <li><A HREF="#scriptalias">ScriptAlias</A>
+<li><A HREF="#scriptaliasmatch">ScriptAliasMatch</A>
 </UL>
 <hr>
 
@@ -64,6 +67,28 @@ See also <A HREF="#scriptalias">ScriptAlias</A>.
 </p>
 <hr>
 
+<h2><A name="aliasmatch">AliasMatch</A></h2>
+<P>
+<strong>Syntax:</strong> AliasMatch <em>regex directory-filename</em><br>
+<Strong>Context:</strong> server config, virtual host<br>
+<strong>Status:</strong> Base<br>
+<strong>Module:</strong> mod_alias<br>
+<strong>Compatibility:</strong> Available in Apache 1.3 and later
+</P>
+
+<p>This directive is equivilent to <a href="#alias">Alias</a>, but
+makes use of standard regular expressions, instead of simple prefix
+matching. The supplied regular expression is matched against the URL,
+and if it matches, the server will substitute any parenthesized
+matches into the given string and use it as a filename. For example,
+to activate the <code>/icons</code> directory, one might use:
+<pre>
+    AliasMatch ^/icons(.*) /usr/local/etc/httpd/icons$1
+</pre>
+</p>
+
+<hr>
+
 <h2><A name="redirect">Redirect directive</A></h2>
 <P>
 <!--%plaintext &lt;?INDEX {\tt Redirect} directive&gt; -->
@@ -128,6 +153,29 @@ the function <code>send_error_response</code> in http_protocol.c).
 </P>
 <HR>
 
+<h2><A name="redirectmatch">RedirectMatch</A></h2>
+<P>
+<strong>Syntax:</strong> RedirectMatch [<em>status</em> <em>regex url</em><br>
+<Strong>Context:</strong> server config, virtual host<br>
+<strong>Status:</strong> Base<br>
+<strong>Module:</strong> mod_alias<br>
+<strong>Compatibility:</strong> Available in Apache 1.3 and later
+</P>
+
+<p>This directive is equivilent to <a href="#alias">Redirect</a>, but
+makes use of standard regular expressions, instead of simple prefix
+matching. The supplied regular expression is matched against the URL,
+and if it matches, the server will substitute any parenthesized
+matches into the given string and use it as a filename. For example,
+to redirect all GIF files to like-named JPEG files on another server,
+one might use:
+<pre>
+    RedirectMatch (.*)\.gif$ http://www.anotherserver.com$1.jpg
+</pre>
+</p>
+
+<hr>
+
 <h2><A name="redirecttemp">RedirectTemp directive</A></h2>
 <P>
 <!--%plaintext &lt;?INDEX {\tt Redirect} directive&gt; -->
@@ -182,6 +230,28 @@ A request for http://myserver/cgi-bin/foo would cause the server to
 run the script /web/cgi-bin/foo.
 </P>
 
+<hr>
+
+<h2><A name="scriptaliasmatch">ScriptAliasMatch</A></h2>
+<P>
+<strong>Syntax:</strong> ScriptAliasMatch <em>regex directory-filename</em><br>
+<Strong>Context:</strong> server config, virtual host<br>
+<strong>Status:</strong> Base<br>
+<strong>Module:</strong> mod_alias<br>
+<strong>Compatibility:</strong> Available in Apache 1.3 and later
+</P>
+
+<p>This directive is equivilent to <a href="#scriptalias">ScriptAlias</a>, but
+makes use of standard regular expressions, instead of simple prefix
+matching. The supplied regular expression is matched against the URL,
+and if it matches, the server will substitute any parenthesized
+matches into the given string and use it as a filename. For example,
+to activate the standard <code>/cgi-bin</code>, one might use:
+<pre>
+    ScriptAlias ^/cgi-bin(.*) /usr/local/etc/httpd/cgi-bin$1
+</pre>
+</p>
+
 <!--#include virtual="footer.html" -->
 </BODY>
 </HTML>