I ended up going down a slightly different path, but figured out where most of the issue is. I had to use %{QUERY_STRING} to get the entire line including the parameters that were being passed after the ?.
I converted to using a couple of RewriteCond's and a RewriteRule instead:
RewriteCond %{REQUEST_URI} ^/mm5/merchant.mvc$ [NC]
RewriteCond %{QUERY_STRING} ^Screen=PROD&Product_Code=ABC123$
RewriteRule ^.*$ http://foobar.com/ABC123?
I don't have the Product_Code generalized yet, so I have coded the couple of entries I am concerned about for now and will pass as variables when I figure it out (hopefully tomorrow).
-Derrick
Quote:
Originally Posted by freerange
Hi,
This is a great forum, thanks for your time.
I have the same need as this poster, but the various solutions don't seem to be working. Other redirects are working without any problems, just these with the ? being passed into them.
Source string from search engine link:
http://www.foobar.com/mm5/merchant.mvc?Screen=PROD&Product_Code=ABC123
Desired redirected string:
http://www.foobar.com/ABC123
Here is what I have tried...
DirectoryIndex home.php index.php
Options +FollowSymLinks
RewriteEngine On
RedirectMatch 301 (.*mm5)(.*Product_Code=)(.*)$ http://www.foobar.com/$3
It matches until I request anything to match after the ? in the original string. Then it just hits my page not found redirect to the homepage.
Any thoughts as to what I am doing wrong?
Thanks! - Derrick
|