PDA

View Full Version : mod rewrite help


catchmeifucan
11-03-2005, 21:20/09:20PM
Hi, I am rewriting this url
/coupons.php?cName=pc-software&cId=134
to

/coupons/pc-software/

this is the rule I used,

#Change coupons.php to coupons/category-name/
RewriteRule ^(.*)coupons/(.*)$ $1coupons.php?cName=$2&cId=$3 [L,NC]

It just didn't work.

Anybody help?

ArmenT
12-03-2005, 13:26/01:26PM
Erm, where's the cid= parameter in your path. If this is important to you, I suggest you use a path like this:
/coupons/pc-software/134/
or
/coupons/pc-software-134/

Assuming you're using the first path, your rewrite rule should look something like this:

RewriteRule ^/coupons/(.*?)/(.*)/$ /coupons.php?cName=$1&cId=$2 [L,NC]

Warning: Haven't actually tested this regexp, so your mileage may vary.

Mod: Shouldn't this be in one of the programming forums?

catchmeifucan
12-03-2005, 13:28/01:28PM
I just don't want the cId in my path

ArmenT
13-03-2005, 21:12/09:12PM
Well, if you don't want the cID in your path, will the web pages still work if it is not specified?