bbs.ChinaUnix.net
首页 | 微博 | 新闻 | Linux | FreeBSD | AIX | Windows | 博客 | 论坛 | 存储 | 网络 | 人才 | Wiki | 资料 | 读书 | 手册 | 下载 | 空间 | 搜索
  免费注册 | 忘记密码 | 会员登录 | 搜索 | 帮助 


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


  首页 » 论坛 » Web服务器 »
[打印] [收藏] [本帖文本页] [推荐此主题给朋友]

在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
复制代码
__________________________________
我将扼住命运的咽喉,它绝不能使我屈服...
我的学习笔记 http://www.kreny.com



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

你最好先设置为绝对本地路径看看效果如何阿
__________________________________
=========================
 小乔可爱,人见人爱,CoreSeek.cn,中文检索,开源发布    
=========================



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

[quote]原帖由 "HonestQiao"]你最好先设置为绝对本地路径看看效果如何阿[/quote 发表:
噢~~忘记说了,还是老样子。~~  所以觉得有点奇怪~~
__________________________________
我将扼住命运的咽喉,它绝不能使我屈服...
我的学习笔记 http://www.kreny.com



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

那最好把你正在使用的那一份httpd.conf之中的相关配置铁上来
__________________________________
=========================
 小乔可爱,人见人爱,CoreSeek.cn,中文检索,开源发布    
=========================



郁闷的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。
__________________________________
我将扼住命运的咽喉,它绝不能使我屈服...
我的学习笔记 http://www.kreny.com



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

那第二个是正确的哦。
__________________________________
=========================
 小乔可爱,人见人爱,CoreSeek.cn,中文检索,开源发布    
=========================



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

[quote]原帖由 "HonestQiao"]那第二个是正确的哦。[/quote 发表:
就是阿~~加上一些页面,或者到其他网站的转向都不行。去掉"/"也不行。很奇怪噢~
楼上的帮我看看
http://bbs.chinaunix.net/forum/13/20040714/367059.html
又有麻烦了。
__________________________________
我将扼住命运的咽喉,它绝不能使我屈服...
我的学习笔记 http://www.kreny.com



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

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

算了~算了~ 不浪费你时间了。我今天不想搞了,哎~~ 复习去了。还要考试呢。
__________________________________
我将扼住命运的咽喉,它绝不能使我屈服...
我的学习笔记 http://www.kreny.com



郁闷的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




QUOTE:
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.

__________________________________
我将扼住命运的咽喉,它绝不能使我屈服...
我的学习笔记 http://www.kreny.com



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

[quote]原帖由 "HonestQiao"]那第二个是正确的哦。[/quote 发表:
问题解决了,谢谢!
__________________________________
我将扼住命运的咽喉,它绝不能使我屈服...
我的学习笔记 http://www.kreny.com


  首页 » 论坛 » Web服务器 »
Copyright © 2001-2010 ChinaUnix.net All Rights Reserved     联系我们:

感谢所有关心和支持过ChinaUnix的朋友们    转载本站内容请注明原作者名及出处

京ICP证041476号


清除 Cookies - ChinaUnix - Archiver - WAP - TOP