私は URL の書き換えにまったく慣れていないので、そのことを知っている人に簡単な質問をしたいと思います。私は e コマース サイトを持っており、現在、商品の URL は次のようになっています www.blizuecomm.net/www/item.php?id=399&ITEM-NAME
<a href="item.php?id=<?=$values[$i]['gitemid']?>&<?=cleanString($values[$i]['gname'])?>
このコードを使用してきれいな文字列を取得します
<?
function cleanString($string, $separator = '-'){
$accents = array('Š' => 'S', 'š' => 's', '?' => 'Dj', 'ð' => 'dj','Ž' => 'Z', 'ž' => 'z', 'È' => 'C' , 'è' => 'c', 'Æ' => 'C' , 'æ' => 'c');
$string = strtr($string, $accents);
$string = strtoupper($string);
$string = preg_replace('/[^a-zA-Z0-9\s]/', '', $string);
$string = preg_replace('{ +}', ' ', $string);
$string = trim($string);
$string = str_replace(' ', $separator, $string);
return $string;
}
?>
www.blizuecomm.net/www/ITEM-NAME または www.blizuecomm.net/ITEM-NAME のような ULR を取得するには、.htaccess ファイルに何を記述すればよいですか?