Forum Moderators: coopster
---------------------------
<?
for($i = 0; $i<strlen($title); $i++){
$c = $title[$i];
if(ereg("[0-9a-zA-Z]", $title[$i])){
$_title = $_title.$c;
}
else{
$_title = $_title."_";
// trying to change _ to - in title
}
$_title = str_replace("__", "_", $_title);
}
?>
----------------------------
htaccess:
RewriteRule^ladies-([0-9a-zA-Z\_\-]*)\.htm([l]?)$cart.php?p=product&product_code=$1 [L]
RewriteRule^([0-9a-zA-Z\_\-]*)\.htm([l]?)$cart.php?p=catalog&catalog_code=$1 [L]
RewriteRule^pages/([0-9a-zA-Z\_\-]*)\.htm([l]?)$cart.php?p=page&page_id=$1 [L]
---------------------------
I've tried swapping the _ with - in both files but then the resultant links with hyphens are not pulling up the page; I get a page missing error.
Can you figure out what I'm doing wrong?
Thanks so much!
RewriteEngine On
RewriteLog "path_to_apache/logs/rewrite.log"
RewriteLogLevel 2
Also your access and error logs might give you some clues. But i'm thinking you also need to change something in cart.php because it's expecting product_code etc. to have underscores in them not hyphens?
BTW, that's quite a code you got there for this:
$_title = preg_replace('{[^0-9-a-zA-Z]+}', '-', $title);
:)