You are here:  » ReWrite Solution

Support Forum



ReWrite Solution

Submitted by thelegacy on Fri, 2010-01-01 00:47 in

Hi David,

I really should know this one, but I'm having a brain freeze over it, I need to parse this code out with a re-write condition if possible, I am calling it from the html folder into my index file, but I want the SEO instead of showing the search.php query string. Code is below:

<?php
  $sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` ORDER BY category";
  if (database_querySelect($sql,$rows))
  {
  print "<ul class='blue'>";
  foreach($rows as $row)
  {
  print "<li><a href='".$config_baseHREF."search.php?q=category:".$row["category"]."'>".$row["category"]."</a></li>";
  }
  print "</ul>";
   }
?>

Thanks in advance,

Ray

Submitted by support on Fri, 2010-01-01 14:15

Hello Ray,

The rewrite version of the category search results is /category/Category-Name/ so in place of:

print "<li><a href='".$config_baseHREF."search.php?q=category:".$row["category"]."'>".$row["category"]."</a></li>";

...have a go with:

print "<li><a href='".$config_baseHREF."category/".tapestry_hyphenate($row["category"])."/'>".$row["category"]."</a></li>";

Cheers,
David.

Submitted by thelegacy on Fri, 2010-01-01 18:45

Yes, Thanks once again, a perfect solution!