Apache-2.2

Apache htaccess -> Nginx 重寫

  • August 12, 2010

請幫助我編寫 nginx 重寫而不是 Apache htaccess:

Options +FollowSymLinks
 RewriteEngine On
 RewriteBase /


 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-l
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)([^/])$ $1$2/ [R,L]

 RewriteCond %{ENV:REDIRECT_RDR} ^$
 RewriteCond %{HTTP_HOST} ^(.+)\.site\.com$
 #RewriteCond %2 !www
 RewriteCond %{HTTP_HOST} !^www\.site\.com$
 RewriteRule ^([a-zA-Z0-9`~!@#$%^&()\-+";=\\/|]*)$ blogs/fake/%2/$1 [L,E=RDR:1]


 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-l
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !/urlrewriteprepend.php$
 RewriteRule ^(.*)$ /urlrewriteprepend.php [L]

這是nginx HttpRewriteModule 文件的連結- 您需要知道的所有內容都應在此文件中提供。

引用自:https://serverfault.com/questions/169697