Forum Moderators: phranque
RewriteCond %{QUERY_STRING} ^currency=USD$ [NC]
RewriteRule ^product_info\.php$ index.php [R=301,L]
RewriteCond %{QUERY_STRING} ^currency=USD$
to the new relevant products or simply to the root
RewriteCond %{QUERY_STRING}(^|&)currency=USD($|&) [NC]
RewriteRule ^product_info.php$ index.php [R=301,L]
[edited by: phranque at 12:18 am (utc) on Nov 1, 2013]
[edit reason] disabled graphic smileys [/edit]
%{QUERY_STRING}(^|&)currency
(^|&)currency=(USD|GPD|EUR)($|&) (^|&)products_id=\d+($|&)
<conditions here>
RewriteRule ^product_info\.php$ /fixup.php [L] I agree that redirecting to a php script would be a good idea, although wouldn't it be better to create a product_info.php page and do all the work inside that?
$product_id = $_GET['products_id'];
if ($product_id == 1) {
header("HTTP/1.1 301 Moved Permanently");
header('Location: http://www.domain.com/product1.html');
} else if ($product_id == 2) {
header("HTTP/1.1 301 Moved Permanently");
header('Location: http://www.product2.html');
}
[edited by: phranque at 11:20 am (utc) on Nov 5, 2013]
[edit reason] unlinked urls [/edit]
Here's a snippet of what I'm using
$product_id = $_GET['products_id'];
if ($product_id == 1) {
header("HTTP/1.1 301 Moved Permanently");
header('Location: http://www.example.com/product1.html');
} else if ($product_id == 2) {
header("HTTP/1.1 301 Moved Permanently");
header('Location: http://www.example.com/product2.html');
}