You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John Nichel <jo...@kegworks.com> on 2004/06/21 16:07:10 UTC

[users@httpd] 301 Redirect maintain query string

Hi,

   I am trying to do a 301 redirect for some old static pages which are 
now done in php.  Sometimes, links from other sites will contain a query 
string (eg. http://blah/blah/page.html?foo=bar).  I need to be able to 
include that query string in the redirect if it exists, but I can't seem 
to figure this out.  In a .htaccess file, I have this...

RedirectMatch 301 /blah/page.html(.*)$ http://new/page.php?$1

And the 301 will send page.html to the new page.php, but it's not 
including the query string.  How can I make this work?  TIA.

-- 
John C. Nichel
KegWorks.com
716.856.9675
john@kegworks.com

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


Re: [users@httpd] 301 Redirect maintain query string

Posted by Tim Burden <ti...@burden.ca>.
Er...I meant the solution John ended up with.

More coffee!

> Yes, and I just trying to use RedirectMatch for my own purposes and it
> doesn't send the query string along...luckily your Rewrite solution was
> right handy :)
>
> ----- Original Message ----- 
> From: "Aaron W Morris" <aa...@mindspring.com>
> To: <us...@httpd.apache.org>
> Sent: Monday, June 21, 2004 3:38 PM
> Subject: Re: [users@httpd] 301 Redirect maintain query string
>
>
> > John Nichel wrote:
> >
> > > Hi,
> > >
> > >   I am trying to do a 301 redirect for some old static pages which are
> > > now done in php.  Sometimes, links from other sites will contain a
query
> > > string (eg. http://blah/blah/page.html?foo=bar).  I need to be able to
> > > include that query string in the redirect if it exists, but I can't
seem
> > > to figure this out.  In a .htaccess file, I have this...
> > >
> > > RedirectMatch 301 /blah/page.html(.*)$ http://new/page.php?$1
> > >
> > > And the 301 will send page.html to the new page.php, but it's not
> > > including the query string.  How can I make this work?  TIA.
> > >
> >
> > Redirect permanent /blah/page.html http://new/page.php
> >
> > I just tested it and it works.
> >
> > -- 
> > Aaron W Morris <aa...@mindspring.com> (decep)
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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


Re: [users@httpd] 301 Redirect maintain query string

Posted by Tim Burden <ti...@burden.ca>.
Yes, and I just trying to use RedirectMatch for my own purposes and it
doesn't send the query string along...luckily your Rewrite solution was
right handy :)

----- Original Message ----- 
From: "Aaron W Morris" <aa...@mindspring.com>
To: <us...@httpd.apache.org>
Sent: Monday, June 21, 2004 3:38 PM
Subject: Re: [users@httpd] 301 Redirect maintain query string


> John Nichel wrote:
>
> > Hi,
> >
> >   I am trying to do a 301 redirect for some old static pages which are
> > now done in php.  Sometimes, links from other sites will contain a query
> > string (eg. http://blah/blah/page.html?foo=bar).  I need to be able to
> > include that query string in the redirect if it exists, but I can't seem
> > to figure this out.  In a .htaccess file, I have this...
> >
> > RedirectMatch 301 /blah/page.html(.*)$ http://new/page.php?$1
> >
> > And the 301 will send page.html to the new page.php, but it's not
> > including the query string.  How can I make this work?  TIA.
> >
>
> Redirect permanent /blah/page.html http://new/page.php
>
> I just tested it and it works.
>
> -- 
> Aaron W Morris <aa...@mindspring.com> (decep)
>
>
>
> ---------------------------------------------------------------------
> 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


Re: [users@httpd] 301 Redirect maintain query string

Posted by Aaron W Morris <aa...@mindspring.com>.
John Nichel wrote:

> Hi,
> 
>   I am trying to do a 301 redirect for some old static pages which are 
> now done in php.  Sometimes, links from other sites will contain a query 
> string (eg. http://blah/blah/page.html?foo=bar).  I need to be able to 
> include that query string in the redirect if it exists, but I can't seem 
> to figure this out.  In a .htaccess file, I have this...
> 
> RedirectMatch 301 /blah/page.html(.*)$ http://new/page.php?$1
> 
> And the 301 will send page.html to the new page.php, but it's not 
> including the query string.  How can I make this work?  TIA.
> 

Redirect permanent /blah/page.html http://new/page.php

I just tested it and it works.

-- 
Aaron W Morris <aa...@mindspring.com> (decep)



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