【问题标题】:NGINX - Two WordPress Installations, subfolder rewrite provlemNGINX - 两个 WordPress 安装,子文件夹重写问题
【发布时间】:2016-08-02 14:41:19
【问题描述】:

我的网站空间上有两个 WP 安装,一个在根目录中,一个在子文件夹“/blog”中。重写规则已设置,但如果我想访问一个 url,例如:

https://www.xyz.de/blog/blogpost1/

我收到 404 错误。根目录的重写规则完美运行。

按照我的 gninx 配置,可能有人可以帮助我:

    if (!-e $request_filename){
    rewrite ^(.*)$ /index.php break;
}

gzip on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json;
gzip_vary on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

【问题讨论】:

  • 好成绩!恭喜!!!

标签: wordpress nginx url-rewriting plesk


【解决方案1】:

添加额外的位置中断,确保它位于服务器 { } 中,而不是在另一个位置案例中。试试这个应该可以的

location /blog {
index index.php;
try_files $uri $uri/ /blog/index.php?$args;
}

location /blog {
index index.php;
try_files $uri $uri/ /blog/index.php last;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-29
    • 1970-01-01
    • 2023-03-20
    • 2016-03-11
    • 1970-01-01
    • 2020-07-29
    • 2016-12-14
    • 1970-01-01
    相关资源
    最近更新 更多