DJ MHA
DJ MHA

Reputation: 598

.htaccess rewrite rule with pagination

I'm trying to write a mod-rewrite rule to handle pagination links on my site.

I'd like my url structure to be this: http://www.mysite.com/classifieds/state/example?page=2

I've tried the following: ^classifieds/city/(.*)?page=(.*) classifieds.php?state=$1&page=$2 [L]

Any guidance would be much appreciated. Thanks

Upvotes: 1

Views: 1470

Answers (1)

anubhava
anubhava

Reputation: 785008

You will need QSA flag to carry over existing query string.

Try this rule:

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteRule ^classifieds/state/([^/]+)/?$ classifieds.php?state=$1 [L,QSA]

RewriteRule ^classifieds/city/([^/]+)/?$ classifieds.php?city=$1 [L,QSA]

Upvotes: 3

Related Questions