7
I’m having trouble reading the code of a particular product from a friendly URL.
With the regular expression I put, it is accepting all the characters that are in front of the product code, ie writing produto/9789/quantidade/5
he understands the product code as 9789/quantidade/5
, and not only the 9789
.
Could someone help me put that 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 in the first URL it goes together to the product code.
Instead of
\/produto\/(.+)\/
place\/produto\/([0-9]+)\/
, as it did for thequantidade
.– Vinícius Gobbo A. de Oliveira