httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [users@httpd] mod_rewrite & query strings -> php variables, sessions
Date Tue, 19 Nov 2002 18:44:28 GMT

On Tue, 19 Nov 2002, Georg Markus Dittrich wrote:
> to put it in a nutshell i would like to know, how i can include the
> query_string in rewrite rules not only on the output side, but on the
> incoming one (the URL, which has to be rewritten);

> RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)\.html\??(.*)
> $1\.php?category=$2\&item=$3\&shop_lang=$4\&type=$5\&$6

This is actually much simpler than you might think.  If you tag the option
[QSA] ("Query String Append") on to the end of the RewriteRule,
mod_rewrite will automatically grab the query string from the request and
add it to the query string of the target.  So you probably just want
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)\.html $1\.php?category=$2\&item=$3\&shop_lang=$4\&type=$5\&$6

In general, you can't match the query string with a RewriteRule.  You need
to use a RewriteCond and match agains %{QUERY_STRING}.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message