将.htaccess的Wordpress 3.0转换为Nginx重写规则
问题描述:
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中会是什么样?
What would it look like in Nginx?
非常感谢您,
Eiso
答
您应尝试在配置文件中进行尝试.对我有用:
You should try in your configuration file. That work for me :
location / {
index index.html index.php;
# URLs that don't exist go to WordPress /index.php PHP FastCGI
if (!-e $request_filename) {
rewrite ^.* /index.php break;
fastcgi_pass 127.0.0.1:9001;
}