httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Montague <>
Subject Re: [users@httpd] Mod-ReWrite
Date Sun, 25 Sep 2011 03:18:53 GMT
On September 24, 2011 23:04 , Suneet Shah <> wrote:
> I tried to add another parameter to the query string and now the 
> different parameters are getting merged together
> I am not sure if my error is in the RewriteCond or in the ReWriteRule. 
> Any ideas?
> URL -> http://localhost/test_rpc/header.jsp?tkn=xyz&userid=mylogin 
> <http://localhost/test_rpc/header.jsp?tkn=xyz&userid=mylogin>
> tkn: xyz;var2:mylogin
> userid: (null)
> RewriteCond %{QUERY_STRING} tkn=(.*)&userid=(.*)
> RewriteRule ^/test_rpc - [E=var1:%1;var2:%2]
> RequestHeader append tkn %{var1}e
> RequestHeader append userid %{var2}e

You would have less problems if you read and followed the 
documentation.  From

> Flags are included in square brackets at the end of the rule, and 
> multiple flags are separated by commas.
> |RewriteRule pattern target [Flag1,Flag2,Flag3]|

The rewrite rule you have above says "set the environment variable named 
'var1' to have the value of the first subexpression matched in the 
rewrite condition, followed by the literal string ';var2:', followed by 
the value of the second subexpression matched in the rewrite 
condition."  This is exactly what you wind up getting as the value of 
the tkn header above.

There is nothing in the documentation that says that the E flag 
understands multiple arguments separated by semicolons -- it does not.  
If you want to set multiple environment variables, you have to use the E 
flag multiple times.

What you wanted is probably

RewriteRule ^/test_rpc - [E=var1:%1,E=var2:%2]

Please take the time to read and understand the documentation 
thoroughly.  This will save you time in the end and be much less 

   Mark Montague

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