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

I would like to be able to map the pretty URL's to the filesystem of a nginx website. However, I am having trouble figuring out how it would work. I would like to take a url like /action/method/param/param2/ and map it to /action/method.php/param/param2. According to the nginx docs something like this should work.

   location / {
            include fastcgi_params;
            # regex: word / word (followed by anything)
            fastcgi_split_path_info ^(\w+/\w+)(.*)$;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name.php;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
share|improve this question
up vote 1 down vote accepted

Try add '/' in first group:

fastcgi_split_path_info ^(/\w+/\w+)(.*)$;
share|improve this answer

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.