Reputation: 21
my .htaccess file works fine with the following url
http://www.mywebsite.com/product/category/Girls-Clothes
.htaccess file:
RewriteEngine On
RewriteRule ^product/category/([a-zA-Z0-9-/]+)$ /product/category/category.php?cid=$1
RewriteRule ^product/category/([a-zA-Z0-9-/]+)/$ /product/category/category.php?cid=$1
but when i use page number along with friendly url, it would not work
http://www.mywebsite.com/product/category/Girls-Clothes?pno=2
i have tow variables cid and pno, CID is mentioned in .htaccess but when i wtore "pno" its gives me sql error.
RewriteRule ^uk/category/([a-zA-Z0-9-/]+)$ /uk/category/category.php?cid=$1?pno=$1
RewriteRule ^uk/category/([a-zA-Z0-9-/]+)/$ /uk/category/category.php?cid=$1?pno=$1
please let me know where i am doing wrong
Upvotes: 1
Views: 398
Reputation: 270607
With your current attempt, you are replacing the value of pno
with the same value in cid
, "Girls-Clothes", and I suspect that isn't what you want.
Just use the QSA
flag to append the existing query string onto the request, so the pno=
is passed through the rewrite along with the cid
parameter you added.
RewriteRule ^uk/category/([a-zA-Z0-9-]+)/?$ /uk/category/category.php?cid=$1 [L,QSA]
Notice also I reduced it to one line by appending /?
and removing /
from the []
to make the trailing slash optional.
Upvotes: 2