apache 自定义404错误页面
2015-11-24 16:01
537 查看
1.有些提供web服务的网站,在用户访问一个不存在的网站文件时,会提示404错误,如下所示:
现在要求自定义一个错误页面,也就是出现404错误代码时,跳转到我们自定义的网址上。下面记录下方法:
1.编辑httpd.conf
找到以上文件,将404那一行注释去掉。去掉之后,在网站根目录下/var/www/html/新建一个错误页面404.html(这里可以修改其它名字,但httpd.conf中也要保持一致),创建后,编辑一下,输入this is test page文字。然后,重启apache
最后,测试一下网站。跳转到错误页面了。
现在要求自定义一个错误页面,也就是出现404错误代码时,跳转到我们自定义的网址上。下面记录下方法:
1.编辑httpd.conf
vim /etc/httpd/conf/httpd.conf # Customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects # # Some examples: #ErrorDocument 500 "The server made a boo boo." #ErrorDocument 404 /404.html #ErrorDocument 404 "/cgi-bin/missing_handler.pl" #ErrorDocument 402 http://www.example.com/subscription_info.html #
找到以上文件,将404那一行注释去掉。去掉之后,在网站根目录下/var/www/html/新建一个错误页面404.html(这里可以修改其它名字,但httpd.conf中也要保持一致),创建后,编辑一下,输入this is test page文字。然后,重启apache
# service httpd restart
最后,测试一下网站。跳转到错误页面了。
相关文章推荐
- Apache Tiles的基本使用
- Apache Stratos探究:结合Mock IaaS,简单的跑一遍Apache Stratos 4.1.0
- 使用linux计划任务自动拉起停止的通达OA服务apache和mysql服务
- 使用linux计划任务自动拉起停止的通达OA服务apache和mysql服务
- piwik流量统计系统搭建(apache2.4+piwik+mysql5.6+php5.6.14)
- RHEL的Apache配置(基于ip&端口&域名的虚拟主机和认证)
- apache相关配置
- Apache Ignite——新一代数据库缓存系统
- win8系统下 配置apache2.4+mod_wsgi4.4+django1.8.6+python3.4
- Apache三种多路处理模块
- log4j xml配置详解
- apache虚拟主机的配置,一个IP绑定多个域名
- 编译安装apache
- Apache mina,Netty的起源和历史
- eclipse加载maven工程提示pom.xml无法解析org.apache.maven.plugins:maven-resources-plugin:2.4.3解决方案
- org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter与org.apache.struts.dispatcher.FilterDispatcher是什么区别?
- Apache Kafka
- APACHE配置文件中文详解
- Apache与Svn环境下配置账号
- 第5章 Apache CXF的架构体系和基础