Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion revised question

View parsed - Show only message text

Received: by 10.141.36.17 with SMTP id o17mr319744rvj.4.1245990563153;
        Thu, 25 Jun 2009 21:29:23 -0700 (PDT)
Return-Path: <avl...@gmail.com>
Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.169])
        by gmr-mx.google.com with ESMTP id 22si240137pxi.2.2009.06.25.21.29.22;
        Thu, 25 Jun 2009 21:29:22 -0700 (PDT)
Received-SPF: pass (google.com: domain of avl...@gmail.com designates 209.85.200.169 as permitted sender) client-ip=209.85.200.169;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of avl...@gmail.com designates 209.85.200.169 as permitted sender) smtp.mail=avl...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by wf-out-1314.google.com with SMTP id 28so683962wfc.10
        for <urlrewrite@googlegroups.com>; Thu, 25 Jun 2009 21:29:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:in-reply-to:references
         :date:message-id:subject:from:to:content-type;
        bh=Q6iGO6yij2rXqXl9DyftDC2koRpUkCsZnAK3TQJWHh8=;
        b=cfopZ0zJj5nHb21z3V32q8AZOqFzoaF4wp4eV0vDn2uCGY+zSygkx7BVQxyWAeVE/u
         NgcnAkRQ7cBS2EUomeIoSUDRSxBmKrYU2Kk6BJsVOoHmeeq3H03M86mBY6CK7kDnqakv
         Vhbh9Ah04UFqDlnmc/SA1NHJIEnbv2wtRGdK8=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        b=fgczxMgC9ELDUB4iEQLoycE4DoP5PjAmz0LKPzW2C2fPrTvVT157sDAbC7KGdHmNRe
         jbBG68nBQ6/8ZHfSfc/1O7gXIZJ2aHClYFN4xr1hCTGwjNoVBToPhHcSre/HPoLN+HH1
         /NW8A67SzjXnybbogCNI473md38TUm1AUo91Y=
Mime-Version: 1.0
Content-Type: multipart/alternative;
	boundary="001636e1fc19d771ef046d38c89b"
Received: by 10.143.158.5 with SMTP id k5mr1245372wfo.279.1245990562000; Thu, 
	25 Jun 2009 21:29:22 -0700 (PDT)
In-Reply-To: <4c5501e7-a59d-4e14-9ac8-d798c77dd473@o5g2000prh.googlegroups.com>
References: <4c5501e7-a59d-4e14-9ac8-d798c77dd473@o5g2000prh.googlegroups.com>
Date: Fri, 26 Jun 2009 09:59:21 +0530
Message-ID: <f19741740906252129u278c5034i6873618e2b975...@mail.gmail.com>
Subject: Re: revised question
From: Avlesh Singh <avl...@gmail.com>
To: urlrewrite@googlegroups.com

--001636e1fc19d771ef046d38c89b
Content-Type: text/plain; charset=ISO-8859-1

*Solution to your problem:
*Try this -
Have two rules in your rewrite config as underneath

<rule>
  <from>^/(.*)\?(.*)$</from>
  <to>/index.cfm?$1&amp;$2</to>
</rule>

<rule>
  <from>^/(.*)$</from>
  <to>/index.cfm?$1</to>
</rule>

The first one would handle all your url's with a queryString. The second one
you obviously know.

*Afterthoughts:
*This kind of a need fits into something known as a QueryStringAppend (QSA)
flag in Apache's mod_rewrite. There is no corresponding support in our
lovely UrlRewrite filter as of now. I created an issue for the same here -
http://code.google.com/p/urlrewritefilter/issues/detail?id=31#c1
If this support were present then your rule could have been as simple as the
underneath and the rewrite filter should have done all the heavy lifting for
you.

<rule qsa="true">
  <from>^/(.*)$</from>
  <to>/index.cfm?$1</to>
</rule>

I am proposing this as a solution for the issue mentioned above.
Thoughts?

Cheers
Avlesh

On Fri, Jun 26, 2009 at 12:19 AM, whostheJBoss
<dotfus...@changethings.org>wrote:

>
> I hope this is more clear.
>
>
> With this URL:
>
> http://www.mysite.com/ms/create/?debugmode=true&debugpass=password
>
> How can I write a rule that will match and rewrite it to:
>
>
> http://www.mysite.com/index.php?PATH_INFO=ms/create/&debugmode=true&debugpass=password
>
> -------------
> -------------
>
> I want to make sure that any of the following URLS would do the same:
>
> http://www.mysite.com/ms/create?debugmode=true&debugpass=password
>
> To:
>
>
> http://www.mysite.com/index.php?PATH_INFO=ms/create/&debugmode=true&debugpass=password
>
>
> I have these next ones working, they are last in the rule list, so I
> really just need the first two figured out, so that they will fire
> before the chain reaches these next two.
>
> THIS: ----
>
> http://www.mysite.com/?debugmode=true&debugpass=password
>
> To:
>
>
> http://www.mysite.com/index.php?PATH_INFO=&debugmode=true&debugpass=password
>
> ----
> AND:
> ----
>
> http://www.mysite.com/?debugmode=true&debugpass=password
>
> To:
>
>
> http://www.mysite.com/index.php?PATH_INFO=&debugmode=true&debugpass=password
>
>
> Basically, I need anything that has a query string (a question mark, ?
> =this=that or ?whatever=something&more=less) to redirect to:
>
> http://www.mysite.com/index.php passing anything before the ? as
> PATH_INFO and anything after as ?=variable=value&variable2=value2, etc
>
> The following rule achieves the first two examples I need:
>
> <rule>
>  <from>^/\?(.*)$</from>
>  <to last="true">/index.cfm?$1</to>
>    <set name="urlrewrite.originalRequestUri">%{request-uri}</set>
>    <set name="urlrewrite.originalQueryString">%{query-string}</set>
> </rule>
>
> (the set elements are not necessary, they are just there for me to use
> later)
>
> However, trying this rule will not match the last two I need, such as
> whatever/whatever/?something=value
>
> <rule>
>  <from>^/\?(.*)$</from>
>  <to last="true">/index.cfm?$1&amp;match=1</to>
>    <set name="urlrewrite.originalRequestUri">%{request-uri}</set>
>    <set name="urlrewrite.originalQueryString">%{query-string}</set>
> </rule>
>
> It ends up matching something like this:
>
> http://www.mysite.com/ms/create/?debugmode=true&debugpass=password
>
> To this rule:
>
> <rule>
>  <from>^/(.*)$</from>
>  <to last="true">/index.cfm?PATH_INFO=$1&amp;match=2</to>
>    <set name="urlrewrite.originalRequestUri">%{request-uri}</set>
>    <set name="urlrewrite.originalQueryString">%{query-string}</set>
> </rule>
>
> And redirecting to:
>
>
> http://www.mysite.com/index.php?PATH_INFO=ms/create/?debugmode=true&debugpass=password
>
> Instead of:
>
>
> http://www.mysite.com/index.php?PATH_INFO=ms/create/&debugmode=true&debugpass=password
>
> It matches everything from /ms... on, including the ? as $1
>
> I can add this:
>
> &amp;%{query-string}to the end of this line:
>
>  <to last="true">/index.cfm?PATH_INFO=$1&amp;match=2&amp;%{query-
> string}</to>
>
> Then I can get the query original query string, but the PATH_INFO
> contains the wrong information, it has the info I need PLUS the extra
> query string information. With the query string added to the end, it
> attempts to go to this URL:
>
>
> http://www.mysite.com/index.php?PATH_INFO=ms/create/?debugmode=true&debugpass=password&debugmode=true&debugpass=true
>
> So, since there is a ? in the PATH_INFO variable, it treats that as
> part of the variable, but the & breaks the variable and starts a new
> one with debugpass. The problem is that the appended query string also
> contains debugpass, so I end up with the value
> debugpass=password,password not debugpass=password
>
> So, I need a way to match everything before the ? as PATH_INFO so that
> I can append the query string without getting a duplicate.
>
> How can I match everything before ? as PATH_INFO and everything
> after ? as the query string?
>
> Thanks! I have been tearing my hair out over this!
>
> >
>

--001636e1fc19d771ef046d38c89b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<b>Solution to your problem:<br></b>Try this - <br>Have two rules in your r=
ewrite config as underneath<br><br>&lt;rule&gt;<br>=A0
&lt;from&gt;^/(.*)\?(.*)$&lt;/from&gt;<br>=A0 &lt;to&gt;/index.cfm?$1&amp;a=
mp;$2&lt;/to&gt;<br>&lt;/rule&gt;<br><br>&lt;rule&gt;<br>
=A0
&lt;from&gt;^/(.*)$&lt;/from&gt;<br>
=A0 &lt;to&gt;/index.cfm?$1&lt;/to&gt;<br>
&lt;/rule&gt;<br>
<br>The first one would handle all your url&#39;s with a queryString. The s=
econd one you obviously know.<br><br><b>Afterthoughts:<br></b>This kind of =
a need fits into something known as a QueryStringAppend (QSA) flag in Apach=
e&#39;s mod_rewrite. There is no corresponding support in our lovely UrlRew=
rite filter as of now. I created an issue for the same here - <a href=3D"ht=
tp://code.google.com/p/urlrewritefilter/issues/detail?id=3D31#c1">http://co=
de.google.com/p/urlrewritefilter/issues/detail?id=3D31#c1</a><br>
If this support were present then your rule could have been as simple as th=
e underneath and the rewrite filter should have done all the heavy lifting =
for you.<br><br>&lt;rule qsa=3D&quot;true&quot;&gt;<br>
=A0
&lt;from&gt;^/(.*)$&lt;/from&gt;<br>
=A0 &lt;to&gt;/index.cfm?$1&lt;/to&gt;<br>
&lt;/rule&gt;<br><br>I am proposing this as a solution for the issue mentio=
ned above.<br>Thoughts?<br><br>Cheers<br>Avlesh<br><br><div class=3D"gmail_=
quote">On Fri, Jun 26, 2009 at 12:19 AM, whostheJBoss <span dir=3D"ltr">&lt=
;<a href=3D"mailto:dotfus...@changethings.org">dotfus...@changethings.org</=
a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I hope this is more clear.<br>
<br>
<br>
With this URL:<br>
<br>
<a href=3D"http://www.mysite.com/ms/create/?debugmode=3Dtrue&amp;debugpass=
=3Dpassword" target=3D"_blank">http://www.mysite.com/ms/create/?debugmode=
=3Dtrue&amp;debugpass=3Dpassword</a><br>
<br>
How can I write a rule that will match and rewrite it to:<br>
<br>
<a href=3D"http://www.mysite.com/index.php?PATH_INFO=3Dms/create/&amp;debug=
mode=3Dtrue&amp;debugpass=3Dpassword" target=3D"_blank">http://www.mysite.c=
om/index.php?PATH_INFO=3Dms/create/&amp;debugmode=3Dtrue&amp;debugpass=3Dpa=
ssword</a><br>

<br>
-------------<br>
-------------<br>
<br>
I want to make sure that any of the following URLS would do the same:<br>
<br>
<a href=3D"http://www.mysite.com/ms/create?debugmode=3Dtrue&amp;debugpass=
=3Dpassword" target=3D"_blank">http://www.mysite.com/ms/create?debugmode=3D=
true&amp;debugpass=3Dpassword</a><br>
<br>
To:<br>
<br>
<a href=3D"http://www.mysite.com/index.php?PATH_INFO=3Dms/create/&amp;debug=
mode=3Dtrue&amp;debugpass=3Dpassword" target=3D"_blank">http://www.mysite.c=
om/index.php?PATH_INFO=3Dms/create/&amp;debugmode=3Dtrue&amp;debugpass=3Dpa=
ssword</a><br>

<br>
<br>
I have these next ones working, they are last in the rule list, so I<br>
really just need the first two figured out, so that they will fire<br>
before the chain reaches these next two.<br>
<br>
THIS: ----<br>
<br>
<a href=3D"http://www.mysite.com/?debugmode=3Dtrue&amp;debugpass=3Dpassword=
" target=3D"_blank">http://www.mysite.com/?debugmode=3Dtrue&amp;debugpass=
=3Dpassword</a><br>
<br>
To:<br>
<br>
<a href=3D"http://www.mysite.com/index.php?PATH_INFO=3D&amp;debugmode=3Dtru=
e&amp;debugpass=3Dpassword" target=3D"_blank">http://www.mysite.com/index.p=
hp?PATH_INFO=3D&amp;debugmode=3Dtrue&amp;debugpass=3Dpassword</a><br>
<br>
----<br>
AND:<br>
----<br>
<br>
<a href=3D"http://www.mysite.com/?debugmode=3Dtrue&amp;debugpass=3Dpassword=
" target=3D"_blank">http://www.mysite.com/?debugmode=3Dtrue&amp;debugpass=
=3Dpassword</a><br>
<br>
To:<br>
<br>
<a href=3D"http://www.mysite.com/index.php?PATH_INFO=3D&amp;debugmode=3Dtru=
e&amp;debugpass=3Dpassword" target=3D"_blank">http://www.mysite.com/index.p=
hp?PATH_INFO=3D&amp;debugmode=3Dtrue&amp;debugpass=3Dpassword</a><br>
<br>
<br>
Basically, I need anything that has a query string (a question mark, ?<br>
=3Dthis=3Dthat or ?whatever=3Dsomething&amp;more=3Dless) to redirect to:<br=
>
<br>
<a href=3D"http://www.mysite.com/index.php" target=3D"_blank">http://www.my=
site.com/index.php</a> passing anything before the ? as<br>
PATH_INFO and anything after as ?=3Dvariable=3Dvalue&amp;variable2=3Dvalue2=
, etc<br>
<br>
The following rule achieves the first two examples I need:<br>
<br>
&lt;rule&gt;<br>
=A0&lt;from&gt;^/\?(.*)$&lt;/from&gt;<br>
=A0&lt;to last=3D&quot;true&quot;&gt;/index.cfm?$1&lt;/to&gt;<br>
 =A0 =A0&lt;set name=3D&quot;urlrewrite.originalRequestUri&quot;&gt;%{reque=
st-uri}&lt;/set&gt;<br>
 =A0 =A0&lt;set name=3D&quot;urlrewrite.originalQueryString&quot;&gt;%{quer=
y-string}&lt;/set&gt;<br>
&lt;/rule&gt;<br>
<br>
(the set elements are not necessary, they are just there for me to use<br>
later)<br>
<br>
However, trying this rule will not match the last two I need, such as<br>
whatever/whatever/?something=3Dvalue<br>
<br>
&lt;rule&gt;<br>
=A0&lt;from&gt;^/\?(.*)$&lt;/from&gt;<br>
=A0&lt;to last=3D&quot;true&quot;&gt;/index.cfm?$1&amp;amp;match=3D1&lt;/to=
&gt;<br>
 =A0 =A0&lt;set name=3D&quot;urlrewrite.originalRequestUri&quot;&gt;%{reque=
st-uri}&lt;/set&gt;<br>
 =A0 =A0&lt;set name=3D&quot;urlrewrite.originalQueryString&quot;&gt;%{quer=
y-string}&lt;/set&gt;<br>
&lt;/rule&gt;<br>
<br>
It ends up matching something like this:<br>
<br>
<a href=3D"http://www.mysite.com/ms/create/?debugmode=3Dtrue&amp;debugpass=
=3Dpassword" target=3D"_blank">http://www.mysite.com/ms/create/?debugmode=
=3Dtrue&amp;debugpass=3Dpassword</a><br>
<br>
To this rule:<br>
<br>
&lt;rule&gt;<br>
=A0&lt;from&gt;^/(.*)$&lt;/from&gt;<br>
=A0&lt;to last=3D&quot;true&quot;&gt;/index.cfm?PATH_INFO=3D$1&amp;amp;matc=
h=3D2&lt;/to&gt;<br>
 =A0 =A0&lt;set name=3D&quot;urlrewrite.originalRequestUri&quot;&gt;%{reque=
st-uri}&lt;/set&gt;<br>
 =A0 =A0&lt;set name=3D&quot;urlrewrite.originalQueryString&quot;&gt;%{quer=
y-string}&lt;/set&gt;<br>
&lt;/rule&gt;<br>
<br>
And redirecting to:<br>
<br>
<a href=3D"http://www.mysite.com/index.php?PATH_INFO=3Dms/create/?debugmode=
=3Dtrue&amp;debugpass=3Dpassword" target=3D"_blank">http://www.mysite.com/i=
ndex.php?PATH_INFO=3Dms/create/?debugmode=3Dtrue&amp;debugpass=3Dpassword</=
a><br>
<br>
Instead of:<br>
<br>
<a href=3D"http://www.mysite.com/index.php?PATH_INFO=3Dms/create/&amp;debug=
mode=3Dtrue&amp;debugpass=3Dpassword" target=3D"_blank">http://www.mysite.c=
om/index.php?PATH_INFO=3Dms/create/&amp;debugmode=3Dtrue&amp;debugpass=3Dpa=
ssword</a><br>

<br>
It matches everything from /ms... on, including the ? as $1<br>
<br>
I can add this:<br>
<br>
&amp;amp;%{query-string}to the end of this line:<br>
<br>
=A0&lt;to last=3D&quot;true&quot;&gt;/index.cfm?PATH_INFO=3D$1&amp;amp;matc=
h=3D2&amp;amp;%{query-<br>
string}&lt;/to&gt;<br>
<br>
Then I can get the query original query string, but the PATH_INFO<br>
contains the wrong information, it has the info I need PLUS the extra<br>
query string information. With the query string added to the end, it<br>
attempts to go to this URL:<br>
<br>
<a href=3D"http://www.mysite.com/index.php?PATH_INFO=3Dms/create/?debugmode=
=3Dtrue&amp;debugpass=3Dpassword&amp;debugmode=3Dtrue&amp;debugpass=3Dtrue"=
 target=3D"_blank">http://www.mysite.com/index.php?PATH_INFO=3Dms/create/?d=
ebugmode=3Dtrue&amp;debugpass=3Dpassword&amp;debugmode=3Dtrue&amp;debugpass=
=3Dtrue</a><br>

<br>
So, since there is a ? in the PATH_INFO variable, it treats that as<br>
part of the variable, but the &amp; breaks the variable and starts a new<br=
>
one with debugpass. The problem is that the appended query string also<br>
contains debugpass, so I end up with the value<br>
debugpass=3Dpassword,password not debugpass=3Dpassword<br>
<br>
So, I need a way to match everything before the ? as PATH_INFO so that<br>
I can append the query string without getting a duplicate.<br>
<br>
How can I match everything before ? as PATH_INFO and everything<br>
after ? as the query string?<br>
<br>
Thanks! I have been tearing my hair out over this!<br>
<br>
<br>
</blockquote></div><br>

--001636e1fc19d771ef046d38c89b--


Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google