Need custom Nginx regex

view full story

http://serverfault.com – Following is what I have right now and it works but needs some improvement. I am guessing that I will need to use regex and that is why I need help. What I need is this http://www.example.com/filename/segment1/segment2/?argk=argv to go to this: http://www.example.com/filename.php/segment1/segment2/?argk=argv Following works without the segments. the index.php works as expected location / { try_files $uri $uri.php?$args; } location ~ \.php$ { try_files $uri $uri/ /index.php?$args; include fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $doc (HowTos)