Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) p.php?id=$1 [L,QSA] 

How would I change that to work with nginx?

Also, where do I place it?

server {
        listen       80;
        root /home/site/public_html;

        location / {
            root   /home/site/public_html;
            index  index.html index.htm;
                proxy_cache my-cache;
                proxy_cache_valid  200 302  60m;
                proxy_cache_valid  404      1m;
                location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
                        expires 30d;
        location ~ \.php$ {
            root           /home/site/public_html;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
share|improve this question
Where is your try_files? – Michael Hampton Apr 24 '13 at 17:14
what is try_files? – Jake Thomas Apr 24 '13 at 17:25

.. from Example for Drupal/FastCGI

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.