zoukankan      html  css  js  c++  java
  • xmapp 404设置

    这样做的好处一个是很友好,另一个是对于你的网站会更安全些,如果没设置,别人在你的网址后随便输入一个路径,会显示404错误,并且会显示你的服务器版本号,服务器配置一目了然,为了避免这种情况,可以设置错误页面。
    当出现404错误,即找不到网页时,把访问者导入到一个事先定义好的错误页面。
    修改 httpd.conf
    找到:
    #ErrorDocument 500 "The server made a boo boo."
    #ErrorDocument 404 /missing.html
    #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
    #ErrorDocument 402 xxxxxxx
    httpd.conf中的这一部分,#ErrorDocument 404 /missing.html 是显示错误页信息的,去掉前面的#
    修改为 ErrorDocument 404 /error.htm,
    其中error.htm为站点根目录下和error目录下的一个错误文件,需要你自己建立。当发生404错误时,进入error.htm页面,可以提示网页没有找到。这样就不可能看到你的服务器软件信息了。也可以设置其它的错误导向的页面,具体http响应错误编号请查阅相关资料。
    重新启动apache,如果没意外,此时已经安装成功,把静态页面放到站点根目录和error目录下,看能不能成功解析。随便输入一个:http://localhost/abcd.htm,看是不是导向你设置的404错误,即error.htm错误页面.!  
     
    百度到这个方法,配置好重启apache之后发现不行。。。
    找了半天看到Include "conf/extra/httpd-multilang-errordoc.conf"这种类似的语句。
    在conf/extra/httpd-multilang-errordoc.conf文件里面发现了
    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
    ErrorDocument 404 /404error.html
    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
    ErrorDocument 410 /error/HTTP_GONE.html.var
    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
    原来是被覆盖掉了
    在这里改掉之后重启apache之后就OK了。。。。
    我安装的是xampp集成环境

  • 相关阅读:
    背水一战 Windows 10 (90)
    背水一战 Windows 10 (89)
    背水一战 Windows 10 (88)
    背水一战 Windows 10 (87)
    背水一战 Windows 10 (86)
    背水一战 Windows 10 (85)
    背水一战 Windows 10 (84)
    背水一战 Windows 10 (83)
    背水一战 Windows 10 (82)
    背水一战 Windows 10 (81)
  • 原文地址:https://www.cnblogs.com/ada-zheng/p/4296186.html
Copyright © 2011-2022 走看看