From: Eric Covener Date: Wed, 4 Nov 2009 23:48:52 +0000 (+0000) Subject: add an early note about the Pattern in a rewriterule behaving X-Git-Tag: 2.3.3~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5848a42169fd2b7d504dfb40f20b555ba8d079a6;p=thirdparty%2Fapache%2Fhttpd.git add an early note about the Pattern in a rewriterule behaving counterintuitively in per-directory context. (lots of mysterious no-op rulesets due to ^/ in htaccess) Tweak QSA text. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832914 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_rewrite.html.en b/docs/manual/mod/mod_rewrite.html.en index 971ae24393e..c5ca76b8124 100644 --- a/docs/manual/mod/mod_rewrite.html.en +++ b/docs/manual/mod/mod_rewrite.html.en @@ -947,11 +947,23 @@ later

What is matched?

The Pattern will initially be matched against the part of the - URL after the hostname and port, and before the query string. If you wish - to match against the hostname, port, or query string, use a + URL after the hostname and port, and before the query string.

+ +

When the RewriteRule appears in per-directory (htaccess) context, the + Pattern is matched against what remains of the URL after removing + the prefix that lead Apache to the current rules (see the + RewriteBase). The removed prefix + always ends with a slash, meaning the matching occurs against a string which + never has a leading slash. A Pattern with ^/ never + matches in per-directory context.

+ +

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.

+ %{QUERY_STRING} variables respectively. If you wish to + match against the full URL-path in a per-directory (htaccess) RewriteRule, + use the %{REQUEST_URI} variable.

+

For some hints on regular @@ -1325,10 +1337,11 @@ cannot use $N in the substitution string!

'qsappend|QSA' (query string append)
- This flag forces the rewrite engine to append a query - string part of the substitution string to the existing string, + This flag forces the rewrite engine to append the query + string part of the substitution string to the existing query string, instead of replacing it. Use this when you want to add more - data to the query string via a rewrite rule.
+ data to the query string via a rewrite rule. This rule has no net effect + unless your substitution explicitly provides a new query string.
'redirect|R [=code]' (force redirect)
diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index f4bd3b7ebe2..ce368f67618 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -959,11 +959,23 @@ RewriteRule ^/$ /homepage.std.html [L] What is matched?

The Pattern will initially be matched against the part of the - URL after the hostname and port, and before the query string. If you wish - to match against the hostname, port, or query string, use a + URL after the hostname and port, and before the query string.

+ +

When the RewriteRule appears in per-directory (htaccess) context, the + Pattern is matched against what remains of the URL after removing + the prefix that lead Apache to the current rules (see the + RewriteBase). The removed prefix + always ends with a slash, meaning the matching occurs against a string which + never has a leading slash. A Pattern with ^/ never + matches in per-directory context.

+ +

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.

+ %{QUERY_STRING} variables respectively. If you wish to + match against the full URL-path in a per-directory (htaccess) RewriteRule, + use the %{REQUEST_URI} variable.

+

For some hints on regular @@ -1342,10 +1354,11 @@ cannot use $N in the substitution string!

'qsappend|QSA' (query string append)
- This flag forces the rewrite engine to append a query - string part of the substitution string to the existing string, + This flag forces the rewrite engine to append the query + string part of the substitution string to the existing query string, instead of replacing it. Use this when you want to add more - data to the query string via a rewrite rule.
+ data to the query string via a rewrite rule. This rule has no net effect + unless your substitution explicitly provides a new query string.
'redirect|R [=code]' (force