httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jurgen <apa...@squarehosting.com>
Subject Re: [users@httpd] Rewrite-problem
Date Mon, 10 Feb 2003 05:17:33 GMT
Hi,

I don't know if this resolved or not, but maybe you try something like this:

# you might want to use a + if you want to test for the existence of a query string
RewriteCond %{QUERY_STRING} ^(.+)$
# The ? after the end of the redirection removes the query string.
RewriteRule ^(.*)     http://www.otherdomain.nl/$1? [R,CO=campaign:%1:.domain.nl]

Jurgen

On Mon, 10 Feb 2003 01:40:30 +0100
"Sander Holthaus - Orange XL" <info@orangexl.com> wrote:

> Sorry, my appologies, the cookie IS written, I forgot to use % instead of $.
> But the ? is still in the path.
> 
> ----- Original Message -----
> From: "Sander Holthaus - Orange XL" <info@orangexl.com>
> To: <users@httpd.apache.org>
> Sent: Monday, February 10, 2003 1:24 AM
> Subject: Re: [users@httpd] Rewrite-problem
> 
> 
> > Thanks Josh, but that's not the case. The ? is in the path and I just
> cannot
> > seem to get it to match.
> > I tried you suggestion (and a few variations of it) but it puts the server
> > in an infinite loop, because as I said, the ?-mark is in the path found by
> > Apache, and thus the rewritten URL also has a querystring in it.
> >
> > I used:
> >
> > RewriteEngine on
> > # RewriteCond %{QUERY_STRING} !^$   # always true?!
> > RewriteCond %{QUERY_STRING} (.*)
> > RewriteRule ^(.*)     http://www.otherdomain.nl/$1
> > [R,CO=campaign:$2:.domain.nl]
> >
> > I don't really know what is, but after some extensive testing, I can only
> > conclude that the rewrite-engine in Apache 2 is still bugged. I could have
> > used $4 or whatever in the above example, it still would have done the
> same,
> > the full path AND query_string are appended to the redirect-URL and the
> > cookie is NOT written.
> >
> > Should I file a bugreport or am I really missing something here?
> >
> > Kind Regards,
> > Sander Holthaus
> >
> > ----- Original Message -----
> > From: "Joshua Slive" <joshua@slive.ca>
> > To: <users@httpd.apache.org>
> > Sent: Monday, February 10, 2003 12:22 AM
> > Subject: Re: [users@httpd] Rewrite-problem
> >
> >
> > >
> > > On Mon, 10 Feb 2003, Sander Holthaus - Orange XL wrote:
> > > > RewriteRule ^([^?]*)\?(.*)$      <http://www.mydomain.com$1>
> > > > http://www.mydomain.com$1
> > > > [R,CO=querystring:$2:.mydomain.com]
> > > >     # put eveything without/until a ? in $1, put everything after
> a/the
> > > > first ? in $2
> > > >     # $1 will be the redirect-uri
> > > >     # $2 will be written as a cookie
> > > >
> > > > The problem seems to the \? in the regex of the rewriterule. The regex
> > > > will
> > > > not match addresses with a ? in them.
> > >
> > > RewriteRule matches only the URL-Path not including the query string.
> To
> > > match the query string, you need to use a RewriteCond as in
> > >
> > > RewriteCond %{QUERY_STRING} (.*)
> > > RerwiteRule ^(.*) http://www.domain.com/$1
> > [R,CO=querystring:%1:.mydomain.com]
> > >
> > > where the %1 is a backreference to the match in the RewriteCond.
> > >
> > > I haven't tested this, but it should point you in the right direction.
> > >
> > > Joshua.
> > >
> > > ---------------------------------------------------------------------
> > > 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@httpd.apache.org
> > >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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@httpd.apache.org
> >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message