Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I rewrite following link in nginx?


Notice .php also, please!

share|improve this question

This could be done with the rewrite directive using capture groups, assuming that there are a fixed number of key/value pairs. Dealing with an arbitrary number of key/value pairs would probably require the Lua module.

rewrite ^/([^/]+)/([^/.]+)\.([^/.]+)/([^/.]+)\.([^/.]+)$ /$1.php?$2=$3&$4=$5
share|improve this answer
Yes it is going to be an arbitrary number of key/value pairs. How about if you don't have to separate the key.value? You know take that as one variable. I can do the slit in the script. – RoboTamer Jun 10 '12 at 5:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.