Nginx Drupal Rewrite

Hendry Lee hendry.lee at
Wed May 20 17:22:09 MSD 2009

> So, just to make clear: this
>  try_files $uri $uri/ /foo/index.php?q=$request_uri;
> does not work, but this
>  try_files $uri $uri/ /foo/index.php?q=$uri&$args;
> works.


> How does Drupal go with zero $args ? I.e., /foo/index.php?$uri& ?

Failed too, as reported by someone earlier. $args is crucial in try_files
for Drupal to work. This is a sample of url that generated an error.


When the PHP code checked the 'operation' variable, as in

if ($_REQUEST['operation']), it returned false.

With try_files $uri $uri/ /foo/index.php?q=$request_uri; it acts exactly
like my previous rewrite line. 

if (!-e $request_filename) {
  rewrite ^/(.*)$ /index.php?q=$1 last;


More information about the nginx mailing list