想在我网站二级目录下“/group/”安装wordpress多用户版,可是wordpress给出的是apache的.haccess规则,如何将.haccess 规则转换为nginx规则。
找了些在线转换工具,转换后都打不开网站。
请教一下两个问题:
1. 二级目录的nginx规则是不是也是写在/a/apps/nginx/vhosts/xxx.com.config文件中。
2. 二级目录多用户wordpress的nginx规则如何写。
麻烦懂这方面的你帮忙指点指点
以下分别是“.haccess规则”和主目录下安装wordpress的nginx规则(用二级域名请自测试,可以实现)。
.haccess规则
RewriteEngine On
RewriteBase /group/
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [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]
主目录下安装wordpress多用户版的nginx规则:
# WordPress multisite subdirectory rules.
# Designed to be included in any server {} block.
# This order might seem weird - this is attempted to match last if rules below fail.
# http冒号//wiki点nginx点org/HttpCoreModule
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Pass uploaded files to wp-includes/ms-files.php.
rewrite /files/$ /index.php last;
# For multisite: Use a caching plugin that creates symlinks to the correct subdirectory structure to get some performance gains.
set $cachetest "$document_root/wp-content/ms-filemap/${host}${uri}";
if ($uri ~ /$) {
set $cachetest "";
}
if (-f $cachetest) {
# Rewrites the URI and stops rewrite processing so it doesn't start over and attempt to pass it to the next rule.
rewrite ^ /wp-content/ms-filemap/${host}${uri} break;
}
if ($uri !~ wp-content/plugins) {
rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}
# Uncomment one of the lines below for the appropriate caching plugin (if used).
#include global/wordpress-ms-subdir-wp-super-cache.conf;
#include global/wordpress-ms-subdir-w3-total-cache.conf;
# Rewrite multisite '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*.php)$ $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*.php)$ $1 last;
}
引用楼主jiansh于2015-07-07 00:57发表的 nginx写二级目录下安装wordpress多用户版伪静态规则 :
想在我网站二级目录下“/group/”安装wordpress多用户版,可是wordpress给出的是apache的.haccess规则,如何将.haccess 规则转换为nginx规则。
找了些在线转换工具,转换后都打不开网站。
请教一下两个问题:
1. 二级目录的nginx规则是不是也是写在/a/apps/nginx/vhosts/xxx.com.config文件中。
2. 二级目录多用户wordpress的nginx规则如何写。
....... [url=http://bbs.aliyun.com/job.php?action=topost&tid=250138&pid=tpc][/url]
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。