解決 WordPress 多站點中使用固定鏈接 /%category%/%postname%/ 格式出現 404 找不到文章或頁面的問題。

正在查看 1 個帖子:1-1 (共 1 個帖子)
  • 作者
    帖子
  • 詩語
    管理員
    • 文章數量: 5,932
    @feibisi
    樓主

    WordPress 多站點中使用固定連接 /%category%/%postname%/ 格式後,

    我們的測試站點一直出現 404 找不到文章或頁面的問題,而且還都挺有特點,完全是基於 /category/wp-XXX 這種的鏈接形式會 404 折騰了半天最後發現居然是偽靜態的問題,因為規則了多了一行。

    rewrite ^.+?(/wp-.*) $1 last;

    只需要刪除這個即可。

    原版的如下

    rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
    if (!-e $request_filename){
    	rewrite ^.+?(/wp-.*) $1 last;
    	rewrite ^.+?(/.*\.php)$ $1 last;
    	rewrite ^ /index.php last;
    }

    修改後的:

    rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
    if (!-e $request_filename){
    	rewrite ^.+?(/.*\.php)$ $1 last;
    	rewrite ^ /index.php last;
    }
正在查看 1 個帖子:1-1 (共 1 個帖子)
  • 哎呀,回覆話題必需登錄。

話題信息

  • 當前位於:WordPress Multisite
  • 0 條回覆
  • 1 個參與人
  • 最後回覆:<a href="https://bbs.weixiaoduo.com/users/feibisi/" title=" 查看詩語的個人資料" class="bbp-author-link"><span class="bbp-author-name"> 詩語</span></a>
  • 上次活動:<a href="https://bbs.weixiaoduo.com/topic/32867/" title=" 解決 WordPress 多站點中使用固定鏈接 /%category%/%postname%/ 格式出現 404 找不到文章或頁面的問題。">5 年、 9 月前</a>