免费注册 查看新帖 |

Chinaunix

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

[Web] 为什么apache的404配置不起作用 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-09-01 16:05 |只看该作者 |倒序浏览
ErrorDocument 404 /404.html
为什么不起作用
我的服务器上配置了多个站点

论坛徽章:
0
2 [报告]
发表于 2006-09-03 10:15 |只看该作者

回复 1楼 strayly 的帖子

需要指定 404文件的绝对路径

论坛徽章:
0
3 [报告]
发表于 2006-09-06 18:29 |只看该作者
为什么写成  ErrorDocument 404 /404.html 不行
写成ErrorDocument 404 http://xxx.com/404.html 却可以
为什么会这样
郁闷死了

[ 本帖最后由 strayly 于 2006-9-6 18:31 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-09-09 01:51 |只看该作者
难道真的没人知道是怎么回事吗?

论坛徽章:
0
5 [报告]
发表于 2006-09-09 08:08 |只看该作者
是的,本机绝对路径。因为每个VirtualHost的配置都不同。

论坛徽章:
0
6 [报告]
发表于 2006-09-09 14:32 |只看该作者
应该是相对路径的。

论坛徽章:
0
7 [报告]
发表于 2006-09-09 18:48 |只看该作者
1.3.x:


  1. #
  2. # Customizable error response (Apache style)
  3. #  these come in three flavors
  4. #
  5. #    1) plain text
  6. #ErrorDocument 500 "The server made a boo boo.
  7. #  n.b.  the single leading (") marks it as text, it does not get output
  8. #
  9. #    2) local redirects
  10. #ErrorDocument 404 /missing.html
  11. #  to redirect to local URL /missing.html
  12. #ErrorDocument 404 /cgi-bin/missing_handler.pl
  13. #  N.B.: You can redirect to a script or a document using server-side-includes.
  14. #
  15. #    3) external redirects
  16. #ErrorDocument 402 http://some.other_server.com/subscription_info.html
  17. #  N.B.: Many of the environment variables associated with the original
  18. #  request will *not* be available to such a script.
复制代码


2.0.x:
  1. #
  2. # Customizable error responses come in three flavors:
  3. # 1) plain text 2) local redirects 3) external redirects
  4. #
  5. # Some examples:
  6. #ErrorDocument 500 "The server made a boo boo."
  7. #ErrorDocument 404 /missing.html
  8. #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
  9. #ErrorDocument 402 http://www.example.com/subscription_info.html
  10. #

  11. #
  12. # Putting this all together, we can internationalize error responses.
  13. #
  14. # We use Alias to redirect any /error/HTTP_<error>.html.var response to
  15. # our collection of by-error message multi-language collections.  We use
  16. # includes to substitute the appropriate text.
  17. #
  18. # You can modify the messages' appearance without changing any of the
  19. # default HTTP_<error>.html.var files by adding the line:
  20. #
  21. #   Alias /error/include/ "/your/include/path/"
  22. #
  23. # which allows you to create your own set of files by starting with the
  24. # @exp_errordir@/include/ files and copying them to /your/include/path/,
  25. # even on a per-VirtualHost basis.  The default include files will display
  26. # your Apache version number and your ServerAdmin email address regardless
  27. # of the setting of ServerSignature.
  28. #
  29. # The internationalized error documents require mod_alias, mod_include
  30. # and mod_negotiation.  To activate them, uncomment the following 30 lines.

  31. #    Alias /error/ "@exp_errordir@/"
  32. #
  33. #    <Directory "@exp_errordir@">
  34. #        AllowOverride None
  35. #        Options IncludesNoExec
  36. #        AddOutputFilter Includes html
  37. #        AddHandler type-map var
  38. #        Order allow,deny
  39. #        Allow from all
  40. #        LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv tr
  41. #        ForceLanguagePriority Prefer Fallback
  42. #    </Directory>
  43. #
  44. #    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
  45. #    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
  46. #    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
  47. #    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
  48. #    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
  49. #    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
  50. #    ErrorDocument 410 /error/HTTP_GONE.html.var
  51. #    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
  52. #    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
  53. #    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
  54. #    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
  55. #    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
  56. #    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
  57. #    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
  58. #    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
  59. #    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
  60. #    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
复制代码

论坛徽章:
0
8 [报告]
发表于 2006-09-09 18:49 |只看该作者
我想是不是因为你用了IE……见鬼,你得把404.html撑大到512子节以上。

论坛徽章:
0
9 [报告]
发表于 2006-09-09 23:26 |只看该作者
我的服务器是win2003
我是配置在 VirtualHost  里的
不管是写 d:/www/404.php ,还是写 /404.php 都不行,惟独写成 http://xx.com/404.php 可以
最郁闷的是我朋友的服务器也是2003,他的却可以
真的是邪门了

论坛徽章:
0
10 [报告]
发表于 2006-09-10 00:30 |只看该作者
原帖由 strayly 于 2006-9-9 23:26 发表
我的服务器是win2003
我是配置在 VirtualHost  里的
不管是写 d:/www/404.php ,还是写 /404.php 都不行,惟独写成 http://xx.com/404.php 可以
最郁闷的是我朋友的服务器也是2003,他的却可以
真的 ...


我想是不是因为你用了IE……见鬼,你得把404.html撑大到512节以上。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP