user1835722
user1835722

Reputation: 17

How to convert querystring to paths URL using mod_rewrite?

I'm trying to rewrite a URL that has a query string to its SEO friendly name i.e. consider

mysite.com/models?p1=v1

I'd like to rewrite it to

mysite.com/models/p1/v1

The user should see the above address in address bar. Any suggesstions?

Upvotes: 1

Views: 805

Answers (1)

Denes Papp
Denes Papp

Reputation: 3982

The .htaccess should be:

RewriteEngine On
RewriteRule ^models/(.+)/(.+)$ models.php?$1=$2 [NC,L]

Upvotes: 3

Related Questions