Waaay OT

Rick Stevens rstevens at vitalstream.com
Wed Jan 24 17:26:38 UTC 2007


On Wed, 2007-01-24 at 13:05 +0100, Andrew Kelly wrote:
> On Tue, 2007-01-23 at 09:47 -0800, Rick Stevens wrote:
> > On Tue, 2007-01-23 at 15:16 +0100, Andrew Kelly wrote:
> > > Hi all,
> > > 
> > > please, forgive the OT nature of this mail, I realize it has nothing to
> > > do with RH. 
> > > I've been googling an apparent rarity and having little luck, and
> > > thought I'd try you all in a hail Mary pass. Perhaps one of you is
> > > Apache guru enough to lend a hand.
> > > 
> > > My problem is, using Mod Rewrite, how do I access payloads? I'd love
> > > access to POST variables as well, of course, but right now what I
> > > primarily want to know is how can I catch the contents of a GET string
> > > to use in a RewriteCond.
> > > 
> > > Concretely:
> > > 
> > > I have a calling URI of
> > > http://domain.name/index.php?var1=value1&var2=value2&var3=value3
> > > 
> > > I want to redirect based on the value of a variable.
> > > 
> > > PseudoCode:
> > > RewriteEngine On
> > > RewriteCond %{GET_VARS} var2=value2
> > > RewriteRule ^/$	http://new.domain.name/path [R,L]
> > > 
> > > Does anybody know the real code to make this happen?
> > 
> 
> Hi Rick, thanks for the pointer.
> 
> > I think you want to look at the "%{QUERY_STRING}" or "%{REQUEST_URI}"
> > variables, not true?  
> 
> Turns out, yes, for GET anyway.
> With POST, the POST_VARS are put in the _POST array and (haven't tested
> yet) I have no idea if _POST is available during rewrite.

Uhm, I think so.  Won't swear to it.  I'm a marginal web programmer at
best.

> > The "%{REQUEST_METHOD}" would give you the GET or
> > PUT.
> > 
> > Oh, and the flags at the end would be "[RL]" (no comma).
> 
> Yes, comma, at least on my RH 7.3 box running Apache/1.3.29
> Otherwise httpd croaks a sad death on reload.

You're right, my bad.  I looked at the "PT" flag and forgot that it was
a single flag (D'oh!).  If you were to use it, it'd be "[PT,R,L]".

> And thank you Bob, for the tip to the right list.

To paraphrase Forrest Gump, "Bob's a smart man..."

----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-        Polygon: A dead parrot (With apologies to John Cleese)      -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list