Apache rewrite to nginx rewrite


#1

apache rewrite rules

RewriteBase /
RewriteCond %{REQUEST_URI} !.(gif|jpeg|png|jpg|bmp)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]


#2

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: