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