这个也不是多高深的技术 望大家莫笑 我写的这些博文 都是自己在工作中遇到的 只是记录一下 工作中遇到的点点滴滴 正所谓日后好相见 这个和我写的nginx 404页面跳转的差不多
- vi /etc/httpd/conf/httpd.conf
- # ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
- # ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
- # ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
- # ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
- ErrorDocument 404 /123.html (配置这一行) 这是全局配置
- # ErrorDocument 405/erro/HTTP_METHOD_NOT_ALLOWED.html.var
- # ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
- # ErrorDocument 410 /error/HTTP_GONE.html.var
- # ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
- # ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
- # ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
- # ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
- # ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
- # ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
- # ErrorDocument 404 /123.html
- 只针对某个虚拟主机配置 404跳转
- NameVirtualHost 192.168.75.129:80
- <VirtualHost 192.168.75.129:80>
- ServerAdmin root@admin
- DocumentRoot /var/www/today
- ServerName www.today.com
- ErrorDocument 404 /123.html
- ErrorLog logs/www.today.com_error_log
- CustomLog logs/www.today.com-access_log common
- </VirtualHost>
- 然后重启apache服务 测试就会看到404错误页面的跳转了
转载于:https://blog.51cto.com/liveforlinux/620893