httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Suneet Shah <suneetshah2...@gmail.com>
Subject Re: [users@httpd] Mod-ReWrite
Date Sun, 25 Sep 2011 03:18:46 GMT
Sorry, please disregard my question.
I found my error.



On Sat, Sep 24, 2011 at 11:04 PM, Suneet Shah <suneetshah2000@gmail.com>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
> 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
>
> thanks for your help
>
>
>
> On Sat, Sep 24, 2011 at 10:44 PM, Suneet Shah <suneetshah2000@gmail.com>wrote:
>
>> Mark,
>>
>> Many thanks for your help. This now works
>>
>> Suneet
>>
>>
>>
>> On Sat, Sep 24, 2011 at 10:33 PM, Mark Montague <mark@catseye.org> wrote:
>>
>>> On September 24, 2011 22:23 , Suneet Shah <suneetshah2000@gmail.com>
>>> wrote:
>>>
>>>> I made the change that you described below. Now the tkn header is coming
>>>> in as null.   Have I made an error in assigning the tkn to var1?
>>>>
>>>> URL -> http://localhost/test_rpc/**header.jsp?tkn=abc<http://localhost/test_rpc/header.jsp?tkn=abc>
>>>> Header value -> tkn: (null)
>>>>
>>>> RewriteCond %{QUERY_STRING} tkn=(.*)
>>>> RewriteRule ^/test_rpc/$ [E=var1:%1]
>>>> RequestHeader append tkn %{var1}e
>>>>
>>>
>>> No, the problem is that the rewrite rule you have above tests for a path
>>> component that exactly matches /test_rpc/ with nothing before it and nothing
>>> after it.  The URL you are testing with has a path component of
>>> /test_rpc/header.jsp -- so this does not match, the rewrite rule does not
>>> get invoked, and the 'var1' environment variable does not get set.
>>>
>>> To get a rewrite rule that tests for the correct thing, see
>>> https://httpd.apache.org/docs/**2.2/rewrite/<https://httpd.apache.org/docs/2.2/rewrite/>in
particular the "Introduction to regular expressions and mod_rewrite"
>>> section.
>>>
>>> Also, you appear to be missing the second argument of the rewrite rule.
>>>  If you don't want to perform a substitution, then the substitution argument
>>> (the argument after the pattern argument and before the flags argument)
>>> needs to be a single dash ("-" without the quotes).
>>>
>>> --
>>>
>>>  Mark Montague
>>>  mark@catseye.org
>>>
>>>
>>
>

Mime
View raw message