Apache 404\403 error page jump

Source: Internet
Author: User

1, the Global use 404 jump

Configure a jump under 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.J PG #配置跳转页面, note that the AA file must be errordocument in the Htdocs root directory 403/abc.jpg #403跳转 </Directory>

#检查配置重新加载配置

Apachectl-t
Syntax OK
Apachectl Graceful

#测试跳转, when there is no home file, it jumps to the 403 error, displaying the 403 error page. When the file or page path is not found, it jumps to the 404 error and displays the 404 error page content.


2, use 403,404 jump page in the virtual host

Pwd/usr/local/httpd/conf/extravim httpd-vhosts.conf
<virtualhost *:80> ServerAdmin [email protected] documentroot "/var/html/www" ServerName www.zhang.com S Erveralias 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

#测试错误页面跳转成功, note here if the error page file is less than 512 bytes, the error page in IE browser will not work, repair method:

ErrorDocument 404 Http://****/403.htmlerrordocument 403 http://****/404.html

Follow up to continue updating ..... .....

This article is from the "Gen Y Rookie" blog, so be sure to keep this source http://zhangxinqi.blog.51cto.com/9668428/1919031

Apache 404\403 error page jump

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.