erik Jr. Member
Joined: 24 Oct 2005 Posts: 65
|
Posted: Mon May 11, 2009 2:25 pm Post subject: Rewrite URLs underscores to dashes |
|
|
To change your rewrite rules to use dashes instead of underscores, use these rewrite rules:
RewriteEngine on
RewriteRule ^category/[0-9A-Za-z\-]+/c?([0-9]+)?m?([0-9]+)?p?([g0-9]+)?a?(1)?n?(1)?s?(1)?/?$ /category.php?category_id=$1&manufacturer_id=$2&page=$3&all=$4&new=$5&sale=$6
RewriteRule ^manufacturer/[0-9A-Za-z\-]+/([0-9]+)/?([0-9]+)?/?$ /category.php?manufacturer_id=$1&category_id=$2
RewriteRule ^item/[0-9A-Za-z\-]+/([0-9]+)/?p?([g0-9]+)?c?([0-9]+)?m?([0-9]+)?/?$ /item.php?item_id=$1&page=$2&category_id=$3&manufacturer_id=$4
RewriteRule ^content/[0-9A-Za-z\-]+/([0-9]+)/?$ /content.php?content_id=$1
RewriteRule ^sale/?$ /category.php?sale=1
RewriteRule ^new/?$ /category.php?new=1
RewriteRule ^all/?$ /category.php?all=1
RewriteRule ^all_manufacturers/?$ /category.php?all_mfg=1
and change this code in /inc/url_def.php:
| Code: | $REWRITE->replace_pattern = array('/&/', '/[^0-9A-Za-z_]+/');
$REWRITE->replace_char = array('and', '_');
|
to:
| Code: | $REWRITE->replace_pattern = array('/&/', '/[^0-9A-Za-z\-]+/');
$REWRITE->replace_char = array('and', '-');
|
|
|