• Apache服务器处理404错误页面技巧


    1.打开Apache目录查找httpd.conf文件 

    2.打开httpd.conf文件找到<Directory "    "></Directory>这对标签( " " 之间是你网站目录的绝对路径) 

    在其中任何一行加入“ErrorDocument 404 /404.html” 如下(我加到了第一行),修改后保存 

    -----------------下面是代码内容----------------- 
    <Directory />
        Options FollowSymLinks
        AllowOverride None
           ErrorDocument 404 /404.html
    </Directory>


    3.重启Apache服务,在网站根目录 E:/website/www下创建404.html,打开网站测试! 


    第二部分 Apache服务器里的单个虚拟主机的独立404页面错误设置 

    1.打开Apache目录,查找httpd.conf文件 

    2ErrorDocument 404 /404.html 指令放在那个虚拟主机的 <VirtualHost ***> 下面就可以了哦 

    3.重启Apache服务,在网站根目录 E:/website/www下创建missing.html,打开网站测试!
    -----------------下面是代码内容----------------- 
    <VirtualHost 127.0.0.1:80>
       directoryindex index.php
       ServerName x.cn
       DocumentRoot E:/host/wwwroot
       ErrorDocument 404 /missing.html
    </VirtualHost>
    注意以上两种设置只在firefox可以显示出来,ie不可以 原因是IE的一个BUG,当404页面文件小于512个字节的时候,这个404就不起作用。我的那个404恰好只有很短的一段。

    解决方法:改成URL方法。    ErrorDocument 404 http://****.com/missing.html

  • 相关阅读:
    linq to entity group by 时间
    Entity Framework Core for Console
    EF Core 多个DbContext迁移命令
    .net for TCP服务端 && 客户端
    创建Windows Service
    EF Code First 快速创建
    在Docker中创建Mongo容器的后续设置
    Docker入门
    Python之collections.defaultdict
    Hough transform(霍夫变换)
  • 原文地址:https://www.cnblogs.com/guoxianglei/p/6898335.html
Copyright © 2020-2023  润新知