我目前的「WordPress 」版本是 2.0.7,以下的解法應該適用於所有 2.0 版本。
先到「WordPress 」後端的平台,選擇『Options』 ->『Permalinks』,之後會進入類似下面的頁面

接下來在第一個方塊裡面將『Custom』選項點選,然後在 input box 裡面填入
/archives/%year%/%monthnum%/%day%/%post_id%/
在第二個方塊裡面的 input box 填入
/categories
這樣「WordPress 」部分的設定就完成了,接下來換「lighttpd」的部分,先打開「lighttpd」的設定檔 /etc /lighttpd.conf (如果你的 lighttpd 有安裝在自訂目錄,就不是這邊指的 /etc 下),然後先將預設關閉的 mod_rewrite 註解拿掉
server.modules = (
"mod_rewrite",
# "mod_redirect",
# "mod_alias",
"mod_access",
....
)
在 url.write 的部分加入一行
url.rewrite = ( "^/(archives|categories|comments|feed)/" => "/index.php" )
尋找 server.error-handler-404 字串,將 http status code 404 的 error-handler 指到 WordPress 主目錄下的 index.php 檔
server.error-handler-404 = "/index.php"
(這邊假設 WordPress 放在根目錄下,如果 WordPress 放在 lighttpd 設定的 virtual hosts 下,請參考 lighttpd 的 virtual hosts 虛擬主機設定)
最後存檔,restart lighttpd 之後,這樣子就大功告成了。
沒有留言:
張貼留言