Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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;
    }
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Try add '/' in first group:

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

Your Answer

 
discard

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.