You are here:  » 301 redirects on product page

Support Forum



301 redirects on product page

Submitted by andys1 on Thu, 2009-01-15 12:14 in

Hello

I am going to turn on search friendly urls (they have always been off). However the product.php pages are already indexed and I am not sure how to redirect product.php?q=product to product.html dynamically without breaking the links are creating duplicate content.

Any ideas?

Regards

Submitted by support on Mon, 2009-01-19 08:47

Hi Andy,

Look for the following code at the top of products.php:

  $q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\."):"");
  $rewrite = isset($_GET["rewrite"]);

...and if you will, from now on, always be using rewite, add this new code immediately afterwards:

  if (!$rewrite)
  {
    $href = $config_baseHREF."product/".tapestry_hyphenate($q).".html";
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: ".$href);
  }

Cheers,
David.