expressions</glossary> can also be used, with the addition of the
<code>~</code> character. For example:</p>
- <highlight language="config"><Directory ~ "^/www/.*/[0-9]{3}"></highlight>
+ <highlight language="config">
+<Directory ~ "^/www/.*/[0-9]{3}">
+
+</Directory>
+</highlight>
<p>would match directories in <code>/www/</code> that consisted of
three numbers.</p>
However, it takes as an argument a
<glossary ref="regex">regular expression</glossary>. For example:</p>
- <highlight language="config"><DirectoryMatch "^/www/(.+/)?[0-9]{3}"></highlight>
+ <highlight language="config">
+<DirectoryMatch "^/www/(.+/)?[0-9]{3}">
+ # ...
+</DirectoryMatch>
+</highlight>
<p>would match directories in <code>/www/</code> that consisted of three
numbers.</p>
can also be used, with the addition of the
<code>~</code> character. For example:</p>
- <highlight language="config"><Files ~ "\.(gif|jpe?g|png)$"></highlight>
+ <highlight language="config">
+<Files ~ "\.(gif|jpe?g|png)$">
+ #...
+</Files>
+</highlight>
<p>would match most common Internet graphics formats. <directive
module="core" type="section">FilesMatch</directive> is preferred,
</p>
<highlight language="config">
<Location /private1>
-# ...
+ # ...
+</Location>
</highlight>
<p>
In the example below, where a trailing slash is used, requests to
</p>
<highlight language="config">
<Location /private2<em>/</em>>
-# ...
+ # ...
+</Location>
</highlight>
<note><title>When to use <directive
can also be used, with the addition of the <code>~</code>
character. For example:</p>
- <highlight language="config"><Location ~ "/(extra|special)/data"></highlight>
+ <highlight language="config">
+<Location ~ "/(extra|special)/data">
+ #...
+</Location>
+</highlight>
<p>would match URLs that contained the substring <code>/extra/data</code>
or <code>/special/data</code>. The directive <directive
it takes a <glossary ref="regex">regular expression</glossary>
as an argument instead of a simple string. For example:</p>
- <highlight language="config"><LocationMatch "/(extra|special)/data"></highlight>
+ <highlight language="config">
+<LocationMatch "/(extra|special)/data">
+ # ...
+</LocationMatch>
+</highlight>
<p>would match URLs that contained the substring <code>/extra/data</code>
or <code>/special/data</code>.</p>