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;
            fastcgi_pass 127.0.0.1:9000;
    }
link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

Try add '/' in first group:

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

Your Answer

 
or
required, but never shown

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