Stasa
Stasa

Reputation: 115

Need help with mod_rewrite

My current code is

RewriteRule ^(.*)$ index.php?pg=$1 [L,QSA]

index.php?action=product shop.com/product
index.php?action=product/add shop.com/product/add

Now I want to add paging to some of the pages, something like

index.php?action=product&page=1&show=20 shop.com/product/1/20
index.php?action=product/add&page=1&show=20 shop.com/product/add/1/20

How do I do this?

Upvotes: 3

Views: 101

Answers (1)

Michiel Pater
Michiel Pater

Reputation: 23033

RewriteEngine On

RewriteRule ^product$ index.php?action=product
RewriteRule ^product/add$ index.php?action=product/add
RewriteRule ^product/(\d+)/(\d+)$ index.php?action=product&page=$1&show=$2
RewriteRule ^product/add/(\d+)/(\d+)$ index.php?action=product/add&page=$1&show=$2


I suggest taking a look at this answer too. I think it would be better in this case.

Upvotes: 2

Related Questions