Updated Version I am developing an E-commerce portal where the products need to be shown with a pretty url and also under categories.
My Current Link: http://abcd.xyz/products.php?pro_tag=1221212112 (FAKE LINK)
My Goal: http://abcd.xyz/products/1221212112 (FAKE LINK)
My Current HTACCESS CODE. (Made it with the help of other Stackoverflow Suggestions) :
RewriteEngine On
RewriteBase /
RewriteRule ^products/([a-zA-Z0-9-]+)/?$ products.php?pro_tag=$1 [QSA,NC,L]
RewriteRule ^products/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ products.php?pro_tag=$2&ctg=$1 [QSA,NC,L]
Figured out the problem: 'pro_tag' isn't being fetched. Need help to fix that.
Try with:
RewriteEngine On
RewriteBase /
RewriteRule ^products/([a-zA-Z0-9-]+)/?$ products.php?pro_tag=$1 [QSA,NC,L]
RewriteRule ^products/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ products.php?pro_tag=$2&ctg=$1 [QSA,NC,L]
I add a ctg
variable...