1

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?

2
  • Do you want to rewrite any query string into the directory like expression? What should be done with the result to not end in 404 error handler? Commented Nov 20, 2012 at 19:51
  • I think you want to the opposite, rewrite mysite.com/models/p1/v1 to mysite.com/models?p1=v1 in order that SE-s see mysite.com/models/p1/v1 Commented Nov 21, 2012 at 1:38

1 Answer 1

3

The .htaccess should be:

RewriteEngine On
RewriteRule ^models/(.+)/(.+)$ models.php?$1=$2 [NC,L]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.