【问题标题】:nginx wordpress clean urls work in only some sub-sitesnginx wordpress clean urls 仅在某些子站点中有效
【发布时间】:2012-10-31 18:53:34
【问题描述】:

我目前将此设置(具有不同的根路径)用于我的 nginx 机器上的另一个站点,对于该站点,这与干净的 url 一起正常工作。

location ^~ /learn {
        root    /var/www/blogs/mysite/learn;
        index   index.php index.html index.htm;
        try_files $uri $uri/ /index.php;

        location ~ \.php$ {
            fastcgi_split_path_info ^(.*\.php)(.*)$;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
            fastcgi_pass 127.0.0.1:9000;
        }
}

但是,当应用于同一台机器上的不同站点时,干净的 url 会导致页面未找到错误。这是为什么呢?

【问题讨论】:

    标签: wordpress nginx clean-urls


    【解决方案1】:

    try_files 行中,我在index.php 之前添加了/learn,从而解决了问题。

    try_files $uri $uri/ /learn/index.php;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-27
      • 1970-01-01
      • 2018-12-11
      • 1970-01-01
      • 1970-01-01
      • 2011-09-08
      相关资源
      最近更新 更多