Nginx, PATH_INFO, and url-rewriting: i must be missing something.

uid_b nginx-forum at
Tue Jan 18 21:45:35 MSK 2011

I'm switching from Apache to Nginx/fcgi and I'm having a small issue
while attempting to setup the applications rewrite rules. 

The code handles routes via the use of PATH_INFO, e.g., will be routed to

I've modified the server configuration to pass PATH_INFO:

	location ~ \.php$ {
          include /etc/nginx/fastcgi_params;
          fastcgi_index  index.php;

          fastcgi_split_path_info ^(.+\.php)(.*)$;
          fastcgi_param SCRIPT_FILENAME 
          fastcgi_param PATH_INFO $fastcgi_path_info;
          fastcgi_param PATH_TRANSLATED

And the rewrite handler:
	location / {
          root   /var/www/public;
          index  index.html index.htm index.php;

          if (!-f $request_filename) {
            rewrite ^(.*)/(.*)$ /index.php/$2 break;
With '__rewrite_log on__', the url's appear to be routing properly:
    [error]: *2 open() "/var/www/public/index.php/test" failed (20: Not
a directory), client:, server:, request: "GET
/test HTTP/1.1", host: "", referrer:
However, it appears to be looking for the directory "test". How can I
force it to request index.php, passing '/test' to the script?

Posted at Nginx Forum:,167319,167319#msg-167319

More information about the nginx mailing list