Forum: NGINX apache rewrite to nginx rewrite

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
杨廷勇 (Guest)
on 2009-03-06 05:02
(Received via mailing list)
apache rewrite rules

RewriteBase /
RewriteCond %{REQUEST_URI}    !\.(gif|jpeg|png|jpg|bmp)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
raptium (Guest)
on 2009-03-06 06:58
(Received via mailing list)
Why you never read others' threads? Someone just asked the same
question and got the answer yesterday.
为什么你不看看别人的帖子,昨天有人问了完全一样的问题并且已经有了答案

---
- Hide quoted text -
On Thu, Mar 05, 2009 at 01:38:45PM +0800, Weibin Y. wrote:

> These are rewrite rules for apache:
>
> RewriteBase /
> RewriteCond %{REQUEST_URI}    !\.(gif|jpeg|png|jpg|bmp)$
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule . index.php [L]
>
> How to change these rules for nginx?

If you use FastCGI and nginx 0.7.x:

location / {
   try_files      $uri  $uri/  @php;
}

location ~ \.(gif|jpe?g|png|bmp)$ {
}

location @php {
   fastcgi_pass   ...;

   fastcgi_param  SCRIPT_FILENAME  /path/to/index.php;

   ... other fastcgi_param
}


2009/3/6 杨廷勇 <removed_email_address@domain.invalid>:
This topic is locked and can not be replied to.