configuration will work as expected:</p>
<highlight language="config">
-Alias /foo/bar /baz
-Alias /foo /gaq
+Alias "/foo/bar" "/baz"
+Alias "/foo" "/gaq"
</highlight>
<p>But if the above two directives were reversed in order, the
file systems.</p>
<highlight language="config">
- Alias /image /ftp/pub/image
+Alias "/image" "/ftp/pub/image"
</highlight>
<p>A request for <code>http://example.com/image/foo.gif</code> would cause
order to expand the alias. That is, if you use</p>
<highlight language="config">
- Alias /icons/ /usr/local/apache/icons/
+Alias "/icons/" "/usr/local/apache/icons/"
</highlight>
<p>then the url <code>/icons</code> will not be aliased, as it lacks
permit access to the target directory.</p>
<highlight language="config">
-Alias /image /ftp/pub/image
+Alias "/image" "/ftp/pub/image"
<Directory "/ftp/pub/image">
Require all granted
</Directory>
<highlight language="config">
<Location "/image">
- Alias /ftp/pub/image
+ Alias "/ftp/pub/image"
</Location>
<LocationMatch "/error/(?<NUMBER>[0-9]+)">
- Alias /usr/local/apache/errors/%{env:MATCH_NUMBER}.html
+ Alias "/usr/local/apache/errors/%{env:MATCH_NUMBER}.html"
</LocationMatch>
</highlight>
use:</p>
<highlight language="config">
- AliasMatch ^/icons(/|$)(.*) /usr/local/apache/icons$1$2
+AliasMatch "^/icons(/|$)(.*)" "/usr/local/apache/icons$1$2"
</highlight>
<p>The full range of <glossary ref="regex">regular expression</glossary>
matching of the URL-path:</p>
<highlight language="config">
- AliasMatch (?i)^/image(.*) /ftp/pub/image$1
+AliasMatch "(?i)^/image(.*)" "/ftp/pub/image$1"
</highlight>
<p>One subtle difference
<p>For example, suppose you want to replace this with AliasMatch:</p>
<highlight language="config">
- Alias /image/ /ftp/pub/image/
+Alias "/image/" "/ftp/pub/image/"
</highlight>
<p>This is NOT equivalent - don't do this! This will send all
requests that have /image/ anywhere in them to /ftp/pub/image/:</p>
<highlight language="config">
- AliasMatch /image/ /ftp/pub/image/
+AliasMatch "/image/" "/ftp/pub/image/"
</highlight>
<p>This is what you need to get the same effect:</p>
<highlight language="config">
- AliasMatch ^/image/(.*)$ /ftp/pub/image/$1
+AliasMatch "^/image/(.*)$" "/ftp/pub/image/$1"
</highlight>
<p>Of course, there's no point in
serve different kinds of files from different directories:</p>
<highlight language="config">
- AliasMatch ^/image/(.*)\.jpg$ /files/jpg.images/$1.jpg<br/>
- AliasMatch ^/image/(.*)\.gif$ /files/gif.images/$1.gif
+AliasMatch "^/image/(.*)\.jpg$" "/files/jpg.images/$1.jpg"<br/>
+AliasMatch "^/image/(.*)\.gif$" "/files/gif.images/$1.gif"
</highlight>
<p>Multiple leading slashes in the requested URL are discarded
<highlight language="config">
# Redirect to a URL on a different host
-Redirect /service http://foo2.example.com/service
+Redirect "/service" "http://foo2.example.com/service"
# Redirect to a URL on the same host
-Redirect /one /two
+Redirect "/one" "/two"
</highlight>
<p>If the client requests <code>http://example.com/service/foo.txt</code>,
<code>send_error_response</code> in http_protocol.c).</p>
<highlight language="config">
-Redirect permanent /one http://example.com/two
-Redirect 303 /three http://example.com/other
+Redirect permanent "/one" "http://example.com/two"
+Redirect 303 "/three" "http://example.com/other"
</highlight>
<p>If the <directive>Redirect</directive> directive is used within a
<highlight language="config">
<Location "/one">
- Redirect permanent http://example.com/two
+ Redirect permanent "http://example.com/two"
</Location><br />
<Location "/three">
- Redirect 303 http://example.com/other
+ Redirect 303 "http://example.com/other"
</Location><br />
<LocationMatch "/error/(?<NUMBER>[0-9]+)">
- Redirect permanent http://example.com/errors/%{env:MATCH_NUMBER}.html
+ Redirect permanent "http://example.com/errors/%{env:MATCH_NUMBER}.html"
</LocationMatch><br />
</highlight>
another server, one might use:</p>
<highlight language="config">
- RedirectMatch (.*)\.gif$ http://other.example.com$1.jpg
+RedirectMatch "(.*)\.gif$" "http://other.example.com$1.jpg"
</highlight>
<p>The considerations related to the difference between
pathname in the local filesystem.</p>
<highlight language="config">
- ScriptAlias /cgi-bin/ /web/cgi-bin/
+ScriptAlias "/cgi-bin/" "/web/cgi-bin/"
</highlight>
<p>A request for <code>http://example.com/cgi-bin/foo</code> would cause the
server to run the script <code>/web/cgi-bin/foo</code>. This configuration
is essentially equivalent to:</p>
<highlight language="config">
-Alias /cgi-bin/ /web/cgi-bin/
-<Location "/cgi-bin" >
+Alias "/cgi-bin/" "/web/cgi-bin/"
+<Location "/cgi-bin">
SetHandler cgi-script
Options +ExecCGI
</Location>
a script or handler you have. For example:</p>
<highlight language="config">
- ScriptAlias /cgi-bin/ /web/cgi-handler.pl
- </highlight>
+ScriptAlias "/cgi-bin/" "/web/cgi-handler.pl"
+ </highlight>
<p>In this scenario all files requested in <code>/cgi-bin/</code> will be
handled by the file you have configured, this allows you to use your own custom
<highlight language="config">
<Location "/cgi-bin">
- ScriptAlias /web/cgi-bin/
+ ScriptAlias "/web/cgi-bin/"
</Location>
<LocationMatch "/cgi-bin/errors/(?<NUMBER>[0-9]+)">
- ScriptAlias /web/cgi-bin/errors/%{env:MATCH_NUMBER}.cgi
+ ScriptAlias "/web/cgi-bin/errors/%{env:MATCH_NUMBER}.cgi"
</LocationMatch><br />
</highlight>
might use:</p>
<highlight language="config">
- ScriptAliasMatch ^/cgi-bin(.*) /usr/local/apache/cgi-bin$1
+ScriptAliasMatch "^/cgi-bin(.*)" "/usr/local/apache/cgi-bin$1"
</highlight>
<p>As for AliasMatch, the full range of <glossary ref="rexex">regular
matching of the URL-path:</p>
<highlight language="config">
- ScriptAliasMatch (?i)^/cgi-bin(.*) /usr/local/apache/cgi-bin$1
+ScriptAliasMatch "(?i)^/cgi-bin(.*)" "/usr/local/apache/cgi-bin$1"
</highlight>
<p>The considerations related to the difference between