Re: Mod-ReWrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On September 24, 2011 23:04 , Suneet Shah <suneetshah2000@xxxxxxxxx> 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>
HEADERS PASSED:
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 https://httpd.apache.org/docs/2.2/rewrite/flags.html

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 frustrating.

--
  Mark Montague
  mark@xxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux