1.有些提供web服务的网站,在用户访问一个不存在的网站文件时,会提示404错误,如下所示:

现在要求自定义一个错误页面,也就是出现404错误代码时,跳转到我们自定义的网址上。下面记录下方法:

  • 1.编辑httpd.conf

    vim /etc/httpd/conf/httpd.conf
    # Customizable error responses come in three flavors:
    # ) plain text ) local redirects ) external redirects
    #
    # Some examples:
    #ErrorDocument "The server made a boo boo."
    #ErrorDocument /.html
    #ErrorDocument "/cgi-bin/missing_handler.pl"
    #ErrorDocument http://www.example.com/subscription_info.html
    #

    找到以上文件,将404那一行注释去掉。去掉之后,在网站根目录下/var/www/html/新建一个错误页面404.html(这里可以修改其它名字,但httpd.conf中也要保持一致),创建后,编辑一下,输入this is test page文字。然后,重启apache

    # service httpd restart

    最后,测试一下网站。跳转到错误页面了。

最新文章

  1. Android中的内容提供器
  2. WCF小白初试 错误之一:“有零个应用程序终结点”的解决办法
  3. C++中静态数据成员
  4. shell test -n -z
  5. struts2文件下载 出现Can not find a java.io.InputStream with the name的错误
  6. mysql中php生成唯一ID
  7. Dialog( 对话框) 组件
  8. fdisk -l 找不到分区怎么办?想办法找到隐藏分区。
  9. Android软件版本更新
  10. currentstyle和getComputedStyle兼容问题
  11. 论SNAPSHOT包的危害性
  12. Add Two Numbers 2015年6月8日
  13. selenium-01 搭建环境
  14. Android进阶(二十七)Android原生扰人烦的布局
  15. 学了两天 react,乱讲一下学习思路,顺便弄了一个脚手架
  16. dbgrideh 哪些行被选中了
  17. MindFusion 中节点关键路径的遍历
  18. python_flask项目(BBS)_01
  19. (原)阅读Android-Camera2Video的demo源码和调试心得
  20. linux gcc编译多个源文件的方法

热门文章

  1. win8 ie10 debug flex
  2. HDU1003 Max Sum
  3. C# Post发送数据返回页面结果
  4. three.js中点生成矩阵方法
  5. LOJ107. 维护全序集【树状数组维护全序集】
  6. 为什么 UEFI 方式启动的 U 盘必须使用 FAT32 文件系统?
  7. biginteger转Long
  8. MySQL 导入.sql文件
  9. c#开发的程序安装时动态指定windows服务名称
  10. vue怎么自定义指令??