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