Forum Moderators: phranque
redirect 301 /mydir/customer/product.php?productid=100001&cat=&page=1 [mysite.com...]
I think the problem has to to with the usage of the "?" and "&" in the document location. I have other 301 redirects established in my .htaccess for static pages that are working jsut fine. Any help would be great!
why not deliver it with php instead for that particular query string
There is an example in the user notes for header [php.net]
$url='http://www.mysite.com/mydir/customer/product.php?productid=100002&cat=&page=1';
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$url);
header("Connection: close");
Redirect permanent /mydir/customer/product.php?productid=100001&cat=&page=1 [mysite.com...]
using permanent instead of 301
take a look here
[httpd.apache.org...]
Welcome to WebmasterWorld!
The problem is that the Redirect directive cannot "see" the query string appended to the URL. This is true on either many or all Apache servers -- I'm not sure which.
If you have access to mod_rewrite, the following code will do what you want:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^productid=100001&cat=&page=1$
RewriteRule ^mydir/customer/product\.php$ http://www.mysite.com/mydir/customer/product.php?productid=100002&cat=&page=1 [R=301,L]
This rule can be expanded to change only the productid and retain the other parameters if needed.
Jim