編輯配置文件,錯誤頁面定製支持三種形式:html
1. 普通文本node
2. 本地跳轉apache
3. 外部跳轉vim
[root@ken-node2 ~]# vim /etc/httpd/conf/httpd.conf
...
327 # 328 # Customizable error responses come in three flavors: 329 # 1) plain text 2) local redirects 3) external redirects 330 # 331 # Some examples: 332 #ErrorDocument 500 "The server made a boo boo." 333 #ErrorDocument 404 /missing.html 334 #ErrorDocument 404 "/cgi-bin/missing_handler.pl" 335 #ErrorDocument 402 http://www.example.com/subscription_info.html ...
第一步:取消332行處的註釋,若是404錯誤就會輸出後面的一句話至頁面瀏覽器
327 # 328 # Customizable error responses come in three flavors: 329 # 1) plain text 2) local redirects 3) external redirects 330 # 331 # Some examples: 332 ErrorDocument 404 "The server made a boo boo." 333 #ErrorDocument 404 /missing.html 334 #ErrorDocument 404 "/cgi-bin/missing_handler.pl" 335 #ErrorDocument 402 http://www.example.com/subscription_info.html
第二步:修改完以後重啓apache測試
[root@ken-node2 ~]# systemctl restart httpd
第三步:瀏覽器訪問一個不存在的內容this
第一步:編輯httpd配置文件spa
#
# Customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects # # Some examples: #ErrorDocument 404 "The server made a boo boo." ErrorDocument 404 /missing.html #ErrorDocument 404 "/cgi-bin/missing_handler.pl" #ErrorDocument 402 http://www.example.com/subscription_info.html
第二步:編寫錯誤頁面rest
[root@ken-node2 html]# echo "this is missing page" > missing.html [root@ken-node2 html]# ls missing.html
第三步:重啓httpdcode
[root@ken-node2 html]# systemctl restart httpd
第四步:瀏覽器測試
第一步: 編輯httpd配置文件
#
# Customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects # # Some examples: #ErrorDocument 404 "The server made a boo boo." #ErrorDocument 404 /missing.html #ErrorDocument 404 "/cgi-bin/missing_handler.pl" ErrorDocument 404 https://www.cnblogs.com/daisyyang/ #取消該行註釋,後面跟上個人外部博客網址 #
第二步:重啓httpd
[root@ken-node2 html]# systemctl restart httpd
第三步:瀏覽器訪問
這個時候輸入錯誤頁面會直接跳轉到個人博客