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 19:50:15 UTC

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

Joshua Slive wrote:
> 
> On Mon, 21 Jun 2004, Eugene Lee wrote:
> 
>> I don't think backreferences (the $1 stuff) works from groupings in the
>> RewriteCond line.  Why not do something simpler?
>>
>>     RewriteEngine On
>>     RewriteRule ^/pages/contact.html\?(.*) 
>> http://www.deluxegrills.com/customer/help.php?section=contactus&mode=update&$1 
>>
> 
> 
> No, that doesn't work because RewriteRule doesn't match against the 
> Query string.  This, however, will work:
> 
> RewriteRule ^/pages/contact.html 
> http://www.deluxegrills.com/customer/help.php?section=contactus&mode=update&$1 
> [QSA]
> 
> where QSA stands for Query String Append (see the mod_rewrite docs).
> 
> Note also that an ordinary Redirect should also copy the query string to 
> the new URL without you have to do anything.  But you can't modify the 
> query string except by using mod_rewrite (as above).
> 
> Joshua.

I was just about to send a reply to my first post saying that I found 
that (QSA).  Thanks for all the help guys.

Rules now look like this, and all is working fine....

RewriteCond %{REQUEST_URI} /pages/contact.html(.*)
RewriteRule .* 
http://www.deluxegrills.com/customer/help.php?section=contactus&mode=update 
[QSA,R=301][OR]

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