views:

168

answers:

1

I'm trying to rewrite the categoy file of my shop system, I also integrated a pagination so I need to rewrite 2 parameters. it almost works, otherwise I wouldn't be posting in here

this is the rewriteurl

RewriteRule ^shop/cat/(.*)/page/([0-9]+)$ /cmstut/shop/cat.php?cat=$1&page=$2 [QSA,L]

This is the url

http://localhost/cmstut/shop/cat/32/page/2

the cat works but not the page and when I print the querystring I get this:

cat=32/page/2

What did I do wrong? I was expecting something like cat=32&page=2 so I could catch the page and show the right page for the pagination.

+1  A: 

You’re probably having two rules where the second one looks like this:

RewriteRule ^shop/cat/(.*)$ /cmstut/shop/cat.php?cat=$1 [QSA,L]

This rule will cause that a request of shop/cat/32/page/2 will be rewritten wrong. You need to use a more specific pattern like this:

RewriteRule ^shop/cat/([^/]+)$ shop/cat.php?cat=$1 [QSA,L]
RewriteRule ^shop/cat/([^/]+)/page/([0-9]+)$ shop/cat.php?cat=$1&page=$2 [QSA,L]
Gumbo
yes exactly, thanks a lot I thought I was editing the first line but I've added a new one... no idea what I was thinking :DI had the same problem with another page where I have the same problem so that's also fixed :D thanks a lot
krike