change rewrite for nginx

Igor Sysoev is at rambler-co.ru
Thu Aug 6 12:58:38 MSD 2009


On Thu, Aug 06, 2009 at 02:44:13PM +0700, Edho P Arief wrote:

> On Thu, Aug 6, 2009 at 8:05 AM, Big Bet<lists at ruby-forum.com> wrote:
> > RewriteCond %{REQUEST_FILENAME} !-f
> > RewriteCond %{REQUEST_FILENAME} !-d
> > RewriteRule . plus.php [L]
> >
> > how to change it for nginx ?
> > help me
> 
> probably something like this
> 
> try_files $uri @plus;
> 
> location @plus
> {
>   fastcgi_param SCRIPT_FILENAME $document_root/plus.php;
>   ....
>   ....
> }

The first way is the best. The lazy way is

 try_files $uri /plus.php;

If you need to test directory too, then add "$uri/":

 try_files $uri $uri/ @plus;

> or if you're feeling lazy
> 
> error_page 404 = /plus.php;
> 
> this probably works, too
> 
> try_files $uri /plus.php;
> 
> or this
> 
> try_files $uri @plus;
> 
> location @plus {
>   rewrite ^.* /plus.php;
> }
> 
> -- 
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list