Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
revised question
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
whostheJBoss  
View profile  
 More options Jun 25, 2:49 pm
From: whostheJBoss <dotfus...@changethings.org>
Date: Thu, 25 Jun 2009 11:49:46 -0700 (PDT)
Local: Thurs, Jun 25 2009 2:49 pm
Subject: revised question
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&d...

-------------
-------------

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&d...

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=p...

----
AND:
----

http://www.mysite.com/?debugmode=true&debugpass=password

To:

http://www.mysite.com/index.php?PATH_INFO=&debugmode=true&debugpass=p...

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&d...

Instead of:

http://www.mysite.com/index.php?PATH_INFO=ms/create/&debugmode=true&d...

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&d...

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!


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Avlesh Singh  
View profile  
 More options Jun 26, 12:29 am
From: Avlesh Singh <avl...@gmail.com>
Date: Fri, 26 Jun 2009 09:59:21 +0530
Local: Fri, Jun 26 2009 12:29 am
Subject: Re: revised question

*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:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
whostheJBoss  
View profile  
 More options Jun 26, 8:04 am
From: whostheJBoss <dotfus...@changethings.org>
Date: Fri, 26 Jun 2009 05:04:46 -0700 (PDT)
Local: Fri, Jun 26 2009 8:04 am
Subject: Re: revised question
Thanks!

The following seems to have accomplished what 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>

<rule>

 <from>^/(.*)$/\?(.*)</from>

 <to last="true">/index.cfm?PATH_INFO=$1&amp;%{query-string}</to>

    <set name="urlrewrite.originalRequestUri">%{request-uri}</set>

    <set name="urlrewrite.originalQueryString">%{query-string}</set>

</rule>

<rule>

 <from>^/(.*)$</from>

 <to last="true">/index.cfm?PATH_INFO=$1&amp;%{query-string}</to>

    <set name="urlrewrite.originalRequestUri">%{request-uri}</set>

    <set name="urlrewrite.originalQueryString">%{query-string}</set>

</rule>

On Jun 25, 9:29 pm, Avlesh Singh <avl...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Avlesh Singh  
View profile  
 More options Jun 26, 9:51 pm
From: Avlesh Singh <avl...@gmail.com>
Date: Sat, 27 Jun 2009 07:21:44 +0530
Local: Fri, Jun 26 2009 9:51 pm
Subject: Re: revised question

Awesome! I can understand why the suggested rules expanded from 2 to 3. :)
If you think it is worth doing, the please vote for the issue -
http://code.google.com/p/urlrewritefilter/issues/detail?id=31

Cheers
Avlesh

On Fri, Jun 26, 2009 at 5:34 PM, whostheJBoss <dotfus...@changethings.org>wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

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