2010-02-17 32 views
0

这是正在使用由WordPress的新版本...为nginx重写wordpress 3.0(多站点)规则?

RewriteEngine On 
RewriteBase BASE/ 

#uploaded files 
RewriteRule ^(.*/)?files/$ index.php [L] 
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.* 
RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L] 

# add a trailing slash to /wp-admin 
RewriteCond %{REQUEST_URI} ^.*/wp-admin$ 
RewriteRule ^(.+)$ $1/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule . - [L] 
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] 
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] 
RewriteRule . index.php [L] 

它将会是什么样Nginx的?

回答

0
location/{ 
root /your/document/root; 
index index.html index.htm index.php; 
if (!-e $request_filename) { 
     rewrite ^.+/?(/wp-.*) $1 last; 
     rewrite ^.+/?(/.*\.php)$ $1 last; 
     rewrite ^(.+)$ /index.php?q=$1 last; 
     } 
} 

location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ 
     { 
     root /your/document/root; 
     rewrite ^/.*(/wp-.*/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last; 

     rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$/wp-includes/ms-files.php?file=$1 last; 
     expires 30d; 
     break; 
     }