From: Joshua Slive
One more note: You can even create URLs in the - substitution string containing a query string part. Just use - a question mark inside the substitution string to indicate - that the following stuff should be re-injected into the - QUERY_STRING. When you want to erase an existing query - string, end the substitution string with just the question - mark.
+The Pattern will not match against the query string.
+ Instead, you must use a RewriteCond
with the
+ %{QUERY_STRING}
variable. You can, however, create
+ URLs in the substitution string containing a query string
+ part. Just use a question mark inside the substitution string to
+ indicate that the following stuff should be re-injected into the
+ query string. When you want to erase an existing query string,
+ end the substitution string with just the question mark. To
+ combine a new query string with an old one, use the
+ [QSA]
flag (see below).
There is a special feature:
When you prefix a substitution field with
http://
thishost[:thisport]
then mod_rewrite automatically strips it
@@ -1342,15 +1347,13 @@ There is a special feature:
URLs is a useful and important feature when used in
combination with a mapping-function which generates the
hostname part. Have a look at the first example in the
- example section below to understand this.
-
Remember: An unconditional external
redirect to your own server will not work with the prefix
http://thishost
because of this feature. To
achieve such a self-redirect, you have to use the
- R-flag (see below).
+ R-flag (see below).
Additionally you can set special flags for @@ -1759,4 +1762,4 @@ RewriteRule ^/([^/]+)/~([^/]+)/(.*)$ /u/${real-to-user:$2|nobody}/$3.$1