3
On the site we have the product area where there may be N levels and sub-levels of categories. htaccess is currently set to accept 2 levels:
RewriteRule ^([a-zA-Z_-]+)/produtos/([^/]*)/([^/]*)/([^/]*) index.php?area=produtos&lang=$1&n1=$2&n2=$3&n3=$4 [NC,QSA,L]
RewriteRule ^([a-zA-Z_-]+)/produtos/([^/]*)/([^/]*) index.php?area=produtos&lang=$1&n1=$2&n2=$3 [NC,QSA,L]
RewriteRule ^([a-zA-Z_-]+)/produtos/([^/]*) index.php?area=produtos&lang=$1&n1=$2 [NC,QSA,L]
The URL is as follows:
localhost/en/products/1-shoes/5-leather/15-slipperXPTO
localhost/en/products/1-shoes/5-leather
localhost/en/products/1-shoes
It works perfectly for 2 levels of categories, but I want to remove this limitation and allow N levels of categories.
How do I move to index.php what is in front of "products/" regardless of the amount of levels?
The rule used and the example do not match. Where the
lang
in the example cited?– Papa Charlie
@Papacharlie I edited the example, I forgot to add the language, in the example I added the "en".
– Filipe Moraes
What’s in front of products, in this case is the language, represented by
$1
, and you’re already going through it withlang=$1
. You can explain better what you wish to do?– Papa Charlie
@Papacharlie does not take language into account (it only serves to pass the selected language to PHP through the lang parameter), the problem is the categories levels as explained above, consider only what is in front of the bar after "products".
– Filipe Moraes