这个也不是多高深的技术  望大家莫笑 我写的这些博文 都是自己在工作中遇到的 只是记录一下 工作中遇到的点点滴滴 正所谓日后好相见 这个和我写的nginx 404页面跳转的差不多

 

  1. vi /etc/httpd/conf/httpd.conf 
  2. #    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var 
  3. #    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var 
  4. #    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var 
  5. #    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var 
  6.     ErrorDocument 404 /123.html  (配置这一行) 这是全局配置 
  7. #    ErrorDocument 405/erro/HTTP_METHOD_NOT_ALLOWED.html.var 
  8. #    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var 
  9. #    ErrorDocument 410 /error/HTTP_GONE.html.var 
  10. #    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var 
  11. #    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var 
  12. #    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var 
  13. #    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var 
  14. #    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var 
  15. #    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var 
  16. #     ErrorDocument 404 /123.html  
  17.  
  18. 只针对某个虚拟主机配置 404跳转 
  19. NameVirtualHost 192.168.75.129:80 
  20. <VirtualHost 192.168.75.129:80> 
  21.     ServerAdmin root@admin 
  22.     DocumentRoot /var/www/today 
  23. ServerName www.today.com 
  24. ErrorDocument 404 /123.html  
  25. ErrorLog logs/www.today.com_error_log 
  26.    CustomLog logs/www.today.com-access_log common 
  27. </VirtualHost> 
  28.  
  29. 然后重启apache服务 测试就会看到404错误页面的跳转了