apache rewrite to nginx rewrite

raptium raptium at gmail.com
Fri Mar 6 07:47:51 MSK 2009


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 Yao 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 杨廷勇 <scyz2 at 163.com>:
> apache rewrite rules
>
> RewriteBase /
> RewriteCond %{REQUEST_URI}    !\.(gif|jpeg|png|jpg|bmp)$
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule . index.php [L]
>
>
> ________________________________
> 网易邮箱,中国第一大电子邮件服务商





More information about the nginx mailing list