nginx progy pass在Wordpress管理员中不起作用

问题描述 投票:0回答:1

我有两个网站网址,例如example.com和wp-example.site.cloud。wp-example是example.com的Wordpress博客,我想在example.com/blog中打开它,所以我在example.com nginx中做到了。

location ^~ /blog {

        rewrite /blog/(.*) /$1  break;
        proxy_http_version 1.1;
       proxy_set_header Host $http_host;
        proxy_request_buffering off; # Disable any internal request bufferring.
        proxy_pass http://wp.lunato;
        server_name_in_redirect off;
     #   proxy_set_header Host $host:$server_port;

    }

效果很好,但是当我打开Wordpress admin时,博客已从url中删除并为我返回404。Wordpress的主页很好,但是当我从菜单打开页面时,URL中没有/ blog并返回404。对这个问题有任何想法吗?

wordpress nginx nginx-reverse-proxy proxypass
1个回答
0
投票

我解决了

wordpress用js代码更改url自动性,所以我在wp-admin / admin-footer.php中添加了js,此代码在wordpress删除后在URL中添加了/ blog:D

© www.soinside.com 2019 - 2024. All rights reserved.