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

Francis Daly francis at
Tue Jan 18 22:27:57 MSK 2011

On Tue, Jan 18, 2011 at 01:45:35PM -0500, uid_b wrote:

Hi there,

> 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

> [code]
> 	location ~ \.php$ {

This location matches a url that ends in the four characters ".php".

> [/code]
> With '__rewrite_log on__', the url's appear to be routing properly:
> [code]
>     [error]: *2 open() "/var/www/public/index.php/test" failed (20: Not

This url is "/index.php/test".  Note that is does not end in the four
characters ".php", and so will not be handled by the previous location

> However, it appears to be looking for the directory "test". How can I
> force it to request index.php, passing '/test' to the script?

Change the "location" to match what you want it to match.

As a quick test, make it just match "php" to confirm that that works as
you want. And then tighten the config so that it won't match things you
don't want it to -- perhaps "starts with /index.php/" is appropriate?

Good luck,

Francis Daly        francis at

More information about the nginx mailing list