1
我在我的.htaccess文件以下行這是在G:/xampp/htdocs/project/public_html/.htaccess
奇怪的.htaccess的ErrorDocument錯誤
ErrorDocument 404 /404.html
所以,當我進入任何非有效地址位於我的電腦上,例如http://localhost/project/public_html/blabla
,下面的消息出現:
Not Found
The requested URL /project/public_html/blabla was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1 Server at localhost Port 80
但這不是我的404.html頁面!
但是,當我編輯ErrorDocument
語法,包括全鏈路,即使它:
ErrorDocument 404 http://localhost/project/public_html/404.html
但這正確重定向不存在的鏈接404.html,但重定向是不是我想要的!我想要一個簡單的404錯誤頁面!
另外一個更奇怪的是,當我從.htaccess文件徹底刪除線,錯誤更改爲:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
1/4/2013 4:27:46 PM
Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
令人毛骨悚然的,是嗎?所以有人可以幫我解決問題,並告訴我怎麼回事?
只是爲了確保....'404.html'位於Web根目錄的最上方,對嗎? – Corbin
根目錄是'G:/ xampp/htdocs /',我的404.html位於'G:/ xampp/htdocs/project/public_html /' –
'/'引用了web根目錄,所以我不確定爲什麼你希望Apache能夠神奇地發現這一點。嘗試改變路徑到'/ project/public_html/404.html'或將404移動到'/ xampp/htdocs /'。 – Corbin