2by
2by

Reputation: 1093

URL Rewrite is not working properly

This is my URL rewrite:

RewriteRule ^cars/$ cars.php    
RewriteRule ^cars/([a-z-]+)/$ /cars.php?model=$1

This works, so my URL is like this:

example.com/cars/porche/

refers to

cars.php?model=porche

Now Im making more search criterias, so I want to be able to add for example model year, car manufactor, etc. like this:

example.com/cars/porche/?model_year=xxx&car_manufactor=xxx

Right now this does not work with the current rewrite, but I can't figure out why.

Upvotes: 0

Views: 64

Answers (1)

Eric Petroelje
Eric Petroelje

Reputation: 60498

Simple, just add QSA:

RewriteRule ^cars/([a-z-]+)/$ /cars.php?model=$1 [QSA]

That tells the rewrite engine to append any other query parameters to the rewritten URL as well.

Upvotes: 2

Related Questions