配置 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%/