繁体   English   中英

奇怪的.htaccess错误文档错误

[英]Strange .htaccess ErrorDocument Error

我的.htaccess文件中的以下行位于我的PC上的G:/xampp/htdocs/project/public_html/.htaccess

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 

令人毛骨悚然,是吗? 所以有人可以帮我一下,告诉我发生了什么吗?

/引用Web根目录,因此您的路径不太有意义。 将文件移动到Web根目录,或更改路径以反映相对于Web根目录的路径。 (将文件移动到/xampp/htdocs ,或将路径更改为/project/public_html/404.html 。)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM