配置 WordPress 固定鏈接是簡單的,只需幾秒,但是理解其工作方式並設置最好的固定鏈接是我們的關鍵,本文基於此,將告訴你如何優化你的固定鏈接。
WordPress 設置固定鏈接
WordPress 允許你設置固定鏈接,你只需要瀏覽到設置》 固定鏈接,即可,下面是英文版的設置面板:
![WordPress provides control over the general structure of your permalinks [ Screenshot: WP Permalink Settings ]](https://img.feibisi.com/2015/04/1455324138.gif)
WordPress 固定鏈接包括一般格式和文章/頁面格式,如果你安裝上面的設置,會出現下面的格式:
- 頁面→
https://www.weixiaoduo.com/about/ - 標籤歸檔 →
https://www.weixiaoduo.com/tag/permalinks/ - 分類歸檔 →
https://www.weixiaoduo.com/category/seo/ - 單篇文章→
https://www.weixiaoduo.com/2010/05/WordPress-json-api-plugin/
現在如何優化呢,有人選擇包括年和月, 但是存在爭論,提出使用如下自定義結構:
/%postname%/
這種簡單的結構產生如下網頁鏈接地址:
https://www.weixiaoduo.com/WordPress-json-api-plugin/
這是一個非常簡單設置, 但是在這篇文章 performance issues involved with using the 「name-only」 permalink format 文章提出了不同的意見. 也許一個較好的結構像下面的:
/%post_id%/%postname%/ /%year%/%postname%/