Using DooPHP on Nginx Rewrite Rule


For those who are using DooPHP with Nginx and wanted to have clean URLs without the index.php, here’s my settings for the rewrite rules. I hope it works for you.

  location ~ \.php {     
     fastcgi_pass  127.0.0.1:9000;
     fastcgi_index index.php;
     include fastcgi_params;
     fastcgi_param SCRIPT_FILENAME C:/nginx/html/$fastcgi_script_name;
     fastcgi_param PATH_INFO $fastcgi_script_name;
     access_log off;
  }

  location /doophp_svn/app/ {
     index  index.php;
     if (!-e $request_filename){
        rewrite (.*) /doophp_svn/app/index.php/$1;
     }
  }

It can be access via:

http://localhost/doophp_svn/app/
http://localhost/doophp_svn/app/index.php
http://localhost/doophp_svn/app/allurl
http://localhost/doophp_svn/app/index.php/allurl
Also, remember to change the configs in the demos for them to work properly. Do change the SITE_PATH, BASE_PATH, SUBFOLDER and APP_URL.

If you have a better solution, do post it in the Tips & Tricks forum

Previous PostNextNext Post

Leave a Reply

Your email address will not be published.