Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24
如何設定 discuz 的 404 錯誤頁面 – unethost無限空間虛擬主機 技術分享部落格

如何設定 discuz 的 404 錯誤頁面

我們曾在:如何編輯或產生自訂的404頁面(自製特色錯誤頁面)介紹過,
關於設定網站404錯誤頁面的方式。

如果是設定discuz,其實可以比照設定就可以解決。

其他的改法:
如果已經有翻過google,查詢過 discuz 404 設置方式。

其中有一種設定方式是:

修改discuz的檔案: source\module\forum\forum_viewthread.php
(或是:source\module\portal\portal_view.php)
不過經我們實測,很可能因為discuz的版本問題,而導致會有路逕不同
修改起來有點囉嗦。

改 .htaccess 的方式比較輕鬆:
.htaccess 的優先權是大於  php (discuz),所以只要改一次後,
無論discuz的版本如何,就可一勞永逸。
1.編輯 .htaccess 。
2.加入一行 ErrorDocument 404 /404.html,並儲存。
3.將 404.html 上傳至相對的路逕。
4.讀取網站錯誤路逕,看是否有被轉到404.html,正確即完成。
所以其實相當的修改方式,都可以套用在不同的套裝程式裡,
當然有的套裝程式本身就有相對的404.html,只要直接去重新編輯,
就可以省下修改 .htaccess 。

(本篇教學由unethost.com客服撰寫)

延伸閱讀:如何備份Cpanel後台安裝的套裝程式?

安裝上述的軟體,我們提供虛擬主機試用,七天滿意保證,
功能完整使用不受限制,歡迎點我申請。