1. 在 lighthttpd 的 config file 當中 wordpress 的部份 (vhost 或 subolder) 加上
server.error-handler-404 = "<your_wordpress_root>/index.php"
2. 修正一下你的 theme 的 404.php
在第一行加上
< ?php header('HTTP/1.1 404 Not Found');?>如果你是用 CGI / FASTCGI 設定的話就是
< ?php header('Status: 404 Not Found',false,404);?>總共才不過兩佪 file 兩行而已,而且執行起來的效率很高。
不但語意上簡單而正確,也能使用顯示自訂的 wordpress 404 頁面。
如果配合 rewrite 的話也可以更一步減少 server 執行 stat() 檢查檔案是否存在而作出的 IO operation
沒有留言:
發佈留言