From 7ac6e25d1588e4792043b790941fdcbdf2969f4e Mon Sep 17 00:00:00 2001
From: Christophe Jaillet
Date: Sat, 20 Feb 2016 06:52:50 +0000
Subject: [PATCH] Add compatibility notes. Synch with trunk
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1731334 13f79535-47bb-0310-9956-ffa450edef68
---
docs/manual/mod/mod_alias.xml | 76 +++++++++++++++++++----------------
1 file changed, 41 insertions(+), 35 deletions(-)
diff --git a/docs/manual/mod/mod_alias.xml b/docs/manual/mod/mod_alias.xml
index 7025970d857..8c574340306 100644
--- a/docs/manual/mod/mod_alias.xml
+++ b/docs/manual/mod/mod_alias.xml
@@ -54,7 +54,7 @@
or LocationMatch
section, expression syntax can be used
to manipulate the destination path or URL.
-
+
mod_alias is designed to handle simple URL
manipulation tasks. For more complicated tasks such as
@@ -98,6 +98,7 @@ Alias "/foo" "/gaq"
would always match before the /foo/bar Alias, so the latter directive would be
ignored.
+
When the Alias,
ScriptAlias and
Redirect directives are used
@@ -130,7 +131,7 @@ Alias "/foo" "/gaq"
file systems.
- Alias "/image" "/ftp/pub/image"
+Alias "/image" "/ftp/pub/image"
A request for http://example.com/image/foo.gif would cause
@@ -145,7 +146,7 @@ Alias "/foo" "/gaq"
order to expand the alias. That is, if you use
- Alias "/icons/" "/usr/local/apache/icons/"
+Alias "/icons/" "/usr/local/apache/icons/"
then the URL /icons will not be aliased, as it lacks
@@ -176,18 +177,20 @@ Alias "/image" "/ftp/pub/image"
Any number slashes in the URL-path parameter
matches any number of slashes in the requested URL-path.
+
If the Alias directive is used within a
Location
or LocationMatch
section the URL-path is omitted, and the file-path is interpreted
- using expression syntax.
+ using expression syntax.
+ This syntax is available in Apache 2.4.19 and later.
-<Location /image>
- Alias /ftp/pub/image
+<Location "/image">
+ Alias "/ftp/pub/image"
</Location>
-<LocationMatch /error/(?<NUMBER>[0-9]+)>
- Alias /usr/local/apache/errors/%{env:MATCH_NUMBER}.html
+<LocationMatch "/error/(?<NUMBER>[0-9]+)">
+ Alias "/usr/local/apache/errors/%{env:MATCH_NUMBER}.html"
</LocationMatch>
@@ -215,7 +218,7 @@ expressions
use:
- AliasMatch "^/icons(/|$)(.*)" "/usr/local/apache/icons$1$2"
+AliasMatch "^/icons(/|$)(.*)" "/usr/local/apache/icons$1$2"
The full range of regular expression
@@ -224,7 +227,7 @@ expressions
matching of the URL-path:
- AliasMatch "(?i)^/image(.*)" "/ftp/pub/image$1"
+AliasMatch "(?i)^/image(.*)" "/ftp/pub/image$1"
One subtle difference
@@ -249,20 +252,20 @@ expressions
For example, suppose you want to replace this with AliasMatch:
- Alias "/image/" "/ftp/pub/image/"
+Alias "/image/" "/ftp/pub/image/"
This is NOT equivalent - don't do this! This will send all
requests that have /image/ anywhere in them to /ftp/pub/image/:
- AliasMatch "/image/" "/ftp/pub/image/"
+AliasMatch "/image/" "/ftp/pub/image/"
This is what you need to get the same effect:
- AliasMatch "^/image/(.*)$" "/ftp/pub/image/$1"
+AliasMatch "^/image/(.*)$" "/ftp/pub/image/$1"
Of course, there's no point in
@@ -383,22 +386,24 @@ Redirect "/one" "/two"
Redirect permanent "/one" "http://example.com/two"
Redirect 303 "/three" "http://example.com/other"
+
If the Redirect directive is used within a
Location
or LocationMatch
section with the URL-path omitted, then the URL parameter will be
- interpreted using expression syntax.
+ interpreted using expression syntax.
+ This syntax is available in Apache 2.4.19 and later.
-<Location /one>
- Redirect permanent http://example.com/two
-</Location>
-<Location /three>
- Redirect 303 http://example.com/other
-</Location>
-<LocationMatch /error/(?<NUMBER>[0-9]+)>
- Redirect permanent http://example.com/errors/%{env:MATCH_NUMBER}.html
-</LocationMatch>
+<Location "/one">
+ Redirect permanent "http://example.com/two"
+</Location>
+<Location "/three">
+ Redirect 303 "http://example.com/other"
+</Location>
+<LocationMatch "/error/(?<NUMBER>[0-9]+)">
+ Redirect permanent "http://example.com/errors/%{env:MATCH_NUMBER}.html"
+</LocationMatch>
@@ -426,7 +431,7 @@ of the current URL
another server, one might use:
- RedirectMatch "(.*)\.gif$" "http://other.example.com$1.jpg"
+RedirectMatch "(.*)\.gif$" "http://other.example.com$1.jpg"
The considerations related to the difference between
@@ -438,7 +443,6 @@ of the current URL
See AliasMatch for
details.
-
@@ -495,7 +499,7 @@ target as a CGI script
pathname in the local filesystem.
- ScriptAlias "/cgi-bin/" "/web/cgi-bin/"
+ScriptAlias "/cgi-bin/" "/web/cgi-bin/"
A request for http://example.com/cgi-bin/foo would cause the
@@ -503,7 +507,7 @@ target as a CGI script
is essentially equivalent to:
Alias "/cgi-bin/" "/web/cgi-bin/"
-<Location "/cgi-bin" >
+<Location "/cgi-bin">
SetHandler cgi-script
Options +ExecCGI
</Location>
@@ -544,19 +548,21 @@ ScriptAlias "/cgi-bin/" "/web/cgi-handler.pl"
ScriptAlias and revealing the source code
of the CGI scripts if they are not restricted by a
Directory section.
+
If the ScriptAlias directive is used within
a Location
or LocationMatch
section with the URL-path omitted, then the URL parameter will be
- interpreted using expression syntax.
+ interpreted using expression syntax.
+ This syntax is available in Apache 2.4.19 and later.
-<Location /cgi-bin >
- ScriptAlias /web/cgi-bin/
+<Location "/cgi-bin">
+ ScriptAlias "/web/cgi-bin/"
</Location>
-<LocationMatch /cgi-bin/errors/(?<NUMBER>[0-9]+)>
- ScriptAlias /web/cgi-bin/errors/%{env:MATCH_NUMBER}.cgi
-</LocationMatch>
+<LocationMatch "/cgi-bin/errors/(?<NUMBER>[0-9]+)">
+ ScriptAlias "/web/cgi-bin/errors/%{env:MATCH_NUMBER}.cgi"
+</LocationMatch>
@@ -584,7 +590,7 @@ and designates the target as a CGI script
might use:
- ScriptAliasMatch "^/cgi-bin(.*)" "/usr/local/apache/cgi-bin$1"
+ScriptAliasMatch "^/cgi-bin(.*)" "/usr/local/apache/cgi-bin$1"
As for AliasMatch, the full range of regular
@@ -593,7 +599,7 @@ and designates the target as a CGI script
matching of the URL-path:
- ScriptAliasMatch "(?i)^/cgi-bin(.*)" "/usr/local/apache/cgi-bin$1"
+ScriptAliasMatch "(?i)^/cgi-bin(.*)" "/usr/local/apache/cgi-bin$1"
The considerations related to the difference between
--
2.47.3