apache 404\403错误页面跳转
2017-04-24 23:40
225 查看
1、全局下使用404跳转
在httpd.conf下配置跳转
2、在虚拟主机中使用403,404跳转页面
apachectl -t
Syntax OK
apachectl graceful
#测试错误页面跳转成功,此处注意如果错误页面文件小于512个字节的时候,在IE浏览器下错误页面将不起作用,修复方法:
在httpd.conf下配置跳转
vim /usr/local/httpd/conf/httpd.conf
<Directory "/usr/local/httpd-2.4.25/htdocs"> AllowOverride None Require all granted ErrorDocument 404 /aa.jpg #配置跳转页面,注意aa文件必须在htdocs根目录下 ErrorDocument 403 /abc.jpg #403跳转 </Directory>#检查配置重新加载配置
apachectl -t
Syntax OK
apachectl graceful#测试跳转,在没有主页文件时会跳转到403错误,显示403错误页面。在找不到文件或页面路径时会跳转到404错误,并显示404错误页面内容。
2、在虚拟主机中使用403,404跳转页面
pwd /usr/local/httpd/conf/extra vim httpd-vhosts.conf
<VirtualHost *:80> ServerAdmin root@123.com DocumentRoot "/var/html/www" ServerName www.zhang.com ServerAlias zhang.com ErrorLog "logs/www-error_log" CustomLog "logs/www-access_log" common ErrorDocument 404 /404.html ErrorDocument 403 /403.html </VirtualHost>#错误页面必须放到DocumentRoot对应的根目录下
ls /var/html/www/ 403.html 404.html index.html.ht#检查配置加载
apachectl -t
Syntax OK
apachectl graceful
#测试错误页面跳转成功,此处注意如果错误页面文件小于512个字节的时候,在IE浏览器下错误页面将不起作用,修复方法:
ErrorDocument 404 http://****/403.html ErrorDocument 403 http://****/404.html[/code]后续继续更新................
相关文章推荐
- Apache 多种方法设置HTTP页面自动跳转到HTTPS
- Apache Shiro会话超时,登录页面跳转到父窗体的解决方法
- apache实现页面重定向(地址跳转)
- apache之404错误页面自定义跳转说明
- apache 网站跳转至同一页面(可用于当网站在备案时显示告示)
- Tomcat启动不了时Apache自动跳转指定页面
- 关于weblogic apache 的页面跳转问题(已解决)
- 配置nginx的403错误页面跳转
- 如何让apache支持伪静态-404跳转页面
- apache配置rewrite后,根目录启用.htaccess,总是跳转到apache默认欢迎页面。
- Apache修改DocumentRoot后访问页面出现403错误的解决办法
- Apache之404错误页面自定义跳转说明
- Android_实现页面跳转(intent的应用)及进阶
- ASP.NET页面内跳转无刷新-- window.location.hash
- 鼠标点击和键盘点击自动跳转页面
- 解决session过期跳转到登陆页面并跳出iframe框架
- Asp.net中实现页面跳转的三种方法比较
- js跳转页面方法
- Android页面跳转