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

How do I do this? This seems to work by default in apache, but not on nginx it appears?

share|improve this question

3 Answers 3

Sounds like you want something like this in your site config:

rewrite ^/(.+)$ /$1.php last; 

This would rewrite anything after the / to a php filename, though there are some cases I would think you'd not want that.

share|improve this answer

A better approach is probably the try_files directive (although this won't handle the /test/ case):

try_files $uri $uri.php?q=$uri&$args;
share|improve this answer
rewrite "^/test/?$" /test.php; 
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.