Page 1 of 1

Pls help about my mod write....

Posted: Fri Sep 30, 2005 6:45 am
by meloncolie
heres my link http://localhost/shopping_cart/products ... 2&amount=1



heres my .htaccess...

RewriteEngine On
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*).html /products.php?addtocart=$1&iid=$2&iname=$3&iprice=$4&amount=$5

pls help because it doesnt work...

:wink:

Posted: Fri Sep 30, 2005 1:44 pm
by Skara
Your regex would validate "////.html".

RewriteRule ^(.+?)/(.+?)/(.+?)/(.+?)/(.+?).html /products.php?addtocart=$1&iid=$2&iname=$3&iprice=$4&amount=$5

Which will validate anything.html that is in a fourth level directory (there have to be four directories above it--no more, no less).

The + means one or more of the previous character. The ? means one or zero normally, but here it stems the .+ so that it only catches one instance of it.

I'm not too familiar with mod_rewrite, but I believe you may need the address there.

RewriteRule ^(.+?)/(.+?)/(.+?)/(.+?)/(.+?).html http://youraddy.ext/products.php?addtoc ... &amount=$5