RewriteRule ^([A-Za-z0-9_\-]+)$ /userviewproducts.php?category=$1 [L]
RewriteRule ^([A-Za-z0-9_\-]+)/$ /userviewproducts.php?category=$1 [L]
RewriteRule ^([A-Za-z0-9_\-]+/[A-Za-z0-9_\-]+)$ /userviewproducts.php?category=$1 [L]
RewriteRule ^([A-Za-z0-9_\-]+/[A-Za-z0-9_\-]+)/$ /userviewproducts.php?category=$1 [L]
RewriteRule ^([A-Za-z0-9_\-]+/[A-Za-z0-9_\-]+/[A-Za-z0-9_\-]+)$ /viewbuyproduct.php?1=$1 [L]
RewriteRule ^([A-Za-z0-9_\-]+/[A-Za-z0-9_\-]+/[A-Za-z0-9_\-]+)/$ /viewbuyproduct.php?1=$1 [L]
I have next rules. They work in that way:
if url = /a or /a/ or /a/a or /a/a/ go to file userviewproducts.php
and if url = /a/a/a or /a/a/a/ go to file viewbuyproduct.php
It works as i need, but i see the CODE-SMELLS term here and want to write it shorter. Will plus every answer =)