I'm having trouble reading a product's code from a friendly URL.
With the regular expression that I put, it is accepting all the characters that are in front of the product code, that is, typing produto/9789/quantidade/5
it understands the product code as 9789/quantidade/5
, not just 9789
.
Could anyone help me put this regular expression correctly?
Here's the one I used:
RewriteRule ^carrinho\/produto\/(.+)?$ carrinho.php?produto=$1&quantidade=1 [NC,L]
RewriteRule ^carrinho\/produto\/(.+)\/quantidade\/([0-9]+)\/?$ carrinho.php?produto=$1&quantidade=$2 [NC,L]
Another problem is that when the user places a /
at the end of the product code on the first URL it goes along to the product code.