免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5154 | 回复: 9
打印 上一主题 下一主题

[Web] 郁闷的ErrorDocument,指定了错误文件却不能实现 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-08-16 20:21 |只看该作者 |倒序浏览
在httpd.conf里面的virtual host里面指定了 ErrorDocument 404 等,想把错误页面重新引导到首页,怎么也不行,不知道怎么回事情。
我的 主域名是 www.mydomain.com ,在主域名里面设置
  1.     ErrorDocument 404 /error.php
复制代码

是可以实现的。此时的error.php放在主域名的根目录下面。
但是在我的virtual hosts却不行。 log里面就是单纯的 404错误,而非200的转向。

我的虚拟域名的设置的一部分

  1. <VirtualHost *:80>;

  2.         ServerName linux.mydomain.com
  3.         DocumentRoot /home/kreny/public_html/
  4.         <Directory "/home/kreny/public_html/">;
  5.             Options FollowSymLinks MultiViews Includes
  6.             ErrorDocument 404 /redirect.html
  7.             ErrorDocument 403 /redirect.html
  8.             AllowOverride ALL
  9.             Order allow,deny
  10.             Allow from all
  11.         </Directory>;

  12.         ErrorDocument 404 /redirect.html
  13.         ErrorDocument 403 /redirect.html
复制代码

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
2 [报告]
发表于 2004-08-16 21:54 |只看该作者

郁闷的ErrorDocument,指定了错误文件却不能实现

你最好先设置为绝对本地路径看看效果如何阿

论坛徽章:
0
3 [报告]
发表于 2004-08-16 21:57 |只看该作者

郁闷的ErrorDocument,指定了错误文件却不能实现

[quote]原帖由 "HonestQiao"]你最好先设置为绝对本地路径看看效果如何阿[/quote 发表:
噢~~忘记说了,还是老样子。~~  所以觉得有点奇怪~~

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
4 [报告]
发表于 2004-08-16 21:58 |只看该作者

郁闷的ErrorDocument,指定了错误文件却不能实现

那最好把你正在使用的那一份httpd.conf之中的相关配置铁上来

论坛徽章:
0
5 [报告]
发表于 2004-08-16 22:21 |只看该作者

郁闷的ErrorDocument,指定了错误文件却不能实现

[quote]原帖由 "HonestQiao"]那最好把你正在使用的那一份httpd.conf之中的相关配置铁上来[/quote 发表:


附加一些测试记录。

修改一

  1.    Errordocument 404 /home/myname/public_html/redirect.html
复制代码

出错为
  1. Not Found
  2. The requested URL /media/1/Sarah_Brightman_Scarborough_Fair.asf was not found on this server.

  3. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
复制代码

但事实上这个文件是存在的。

修改二
  1. Errordocument 404 /
复制代码

成功到首页,但是address栏上还是原来的不存在的url。

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
6 [报告]
发表于 2004-08-16 22:33 |只看该作者

郁闷的ErrorDocument,指定了错误文件却不能实现

那第二个是正确的哦。

论坛徽章:
0
7 [报告]
发表于 2004-08-16 23:00 |只看该作者

郁闷的ErrorDocument,指定了错误文件却不能实现

[quote]原帖由 "HonestQiao"]那第二个是正确的哦。[/quote 发表:
就是阿~~加上一些页面,或者到其他网站的转向都不行。去掉"/"也不行。很奇怪噢~
楼上的帮我看看
http://bbs.chinaunix.net/forum/13/20040714/367059.html
又有麻烦了。

论坛徽章:
0
8 [报告]
发表于 2004-08-16 23:07 |只看该作者

郁闷的ErrorDocument,指定了错误文件却不能实现

[quote]原帖由 "HonestQiao"]那第二个是正确的哦。[/quote 发表:

算了~算了~ 不浪费你时间了。我今天不想搞了,哎~~ 复习去了。还要考试呢。

论坛徽章:
0
9 [报告]
发表于 2004-08-18 18:14 |只看该作者

郁闷的ErrorDocument,指定了错误文件却不能实现

http://weblog.dalouis.com/archives/2004/08/errordocument_e.html

Errordocument 设置后不能实行设定值的问题
Posted by kreny at August 18, 2004 07:07 PM | Trackback URL: http://weblog.dalouis.com/cgi-bin/mt-tb.cgi/121
在apache的httpd.conf里面设定了我们自己定制的error document或者forbbiden document的显示页面,但是往往在设置以后没有什么效果。今天读了apache的文档后才发现自己绕了一个远路,原来是文档大小太小(小于512字节),自动被IE忽略了。

http://httpd.apache.org/docs-2.0/mod/core.html#errordocument


Microsoft Internet Explorer (MSIE) will by default ignore server-generated error messages when they are "too small" and substitute its own "friendly" error messages. The size threshold varies depending on the type of error, but in general, if you make your error document greater than 512 bytes, then MSIE will show the server-generated error rather than masking it. More information is available in Microsoft Knowledge Base article Q294807.

论坛徽章:
0
10 [报告]
发表于 2004-08-18 18:16 |只看该作者

郁闷的ErrorDocument,指定了错误文件却不能实现

[quote]原帖由 "HonestQiao"]那第二个是正确的哦。[/quote 发表:
问题解决了,谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP