Return-Path: RewriteRule
directive is defined.
In VirtualHost
context,
+
+
In VirtualHost
context,
The Pattern will initially be matched against the part of the
URL after the hostname and port, and before the query string (e.g. "/app1/index.html").
- This is the (%-decoded) URL-path.
In Directory
and htaccess context,
+ the Pattern is matched against only a partial path, for example a request
+ of "/app1/index.html" may result in comparison against "app1/index.html"
+ or "index.html" depending on where the RewriteRule
is
+ defined.
In this context, only the trailing portion of the currently mapped + filesystem is compared against. The directory path where the rule is defined + is stripped before comparison (up to and including a trailing slash). + The net result of this per-directory prefix stripping is that rules in + this context only match against the portion of the currently mapped path + "below" where they are defined.
-In Directory
and htaccess context,
- the Pattern is matched against the trailing portion of the currently
- mapped filesystem path with the rules own directory path removed from the beginning
- (up to and including a trailing slash). Directives such as DocumentRoot
and Alias
, or even the
+
Directives such as DocumentRoot
and Alias
, or even the
result of previous RewriteRule
substitutions, determine
- the currently mapped filesystem path. The net result of this per-directory
- prefix stripping is that rules in this context only match against the portion
- of the currently mapped path "below" where they are defined.
If you wish to match against the hostname, port, or query string, use a +
If you wish to match against the hostname, port, or query string, use a
RewriteCond
with the
%{HTTP_HOST}
, %{SERVER_PORT}
, or
- %{QUERY_STRING}
variables respectively.
In any case, remember that regular expressions are substring
- matches. That is, you don't need the regex to describe the entire
- string, just the part that you wish to match. Thus, using a regex
- of .
is often sufficient rather than .*
,
- and the regex abc
is not the same as
- ^abc$
.
%{QUERY_STRING}
variables respectively.