将.htaccess的Wordpress 3.0转换为Nginx重写规则 [英] Wordpress 3.0 conversion of .htaccess to nginx rewrite rules

查看:92
本文介绍了将.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;
        }

http://www.farinspace.com/wordpress-nginx-rewrite-rules /

这篇关于将.htaccess的Wordpress 3.0转换为Nginx重写规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆