2013-06-28 37 views
0

我想使用.htaccess自定義錯誤頁面。此文件夾中:/home/tamp/public_html/sandbox/test,我把.htaccess文件了,裏面我把這個行: ErrorDocument 404 /home/tamp/public_html/sandbox/test/error.html, 然後在前端,我做了一個測試,我打開mysite/sandbox/test/te.php(te.php does not exist),但它仍然顯示默認的錯誤頁面:The requested URL /test/tes.php was not found on this server。我的error.html沒有顯示。 那麼這裏可能會出現什麼問題?問題與自定義錯誤頁面使用.htaccess

回答

0

用的ErrorDocument您不能使用完整的文件系統路徑:

URL可以與本地網絡的路徑斜槓(/)(相對於 的DocumentRoot)開始,或者是一個完整的URL客戶可以解決這個問題。

所以假設你的網站的根文件夾是沙箱:

ErrorDocument 404 /test/error.html