2015-05-06 47 views
1

我想爲我的小型web服務器創建一個自定義錯誤頁面,該頁面在raspbian上的apache2上運行。但遺憾的是,創建的頁面在瀏覽器無法解析的情況下不會被瀏覽器加載......瀏覽器只是在左上角打印創建的錯誤頁面的路徑。Apache2自定義404頁面將不會加載(.htaccess)

HTML自定義頁面至今:

<!DOCTYPE html><html><head></head><body><p>Nooooot found ...</p></body></html> 

加載頁面的HTML:

<html><head></head><body>sites/errorsites/404.html</bod></html> 

我的.htaccess文件,這是擺在/ var/WWW/

Options -Indexes 
ErrorDocument 404 sites/errorsites/404.html 

我的errorsites-dir的位置與自定義錯誤:/ var/www/sites/

(當然我在/ etc/apache2的/網站,提供給 「所有」 的默認文件中設置有 「AllowOverride」。)

感謝您的幫助

盧卡斯

編輯:

的ServerAdmin網站管理員@本地

DocumentRoot /var/www 
<Directory /> 
    Options FollowSymLinks 
    AllowOverride None 
</Directory> 
<Directory /var/www/> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride All 
    Order allow,deny 
    allow from all 
</Directory> 

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
<Directory "/usr/lib/cgi-bin"> 
    AllowOverride None 
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
    Order allow,deny 
    Allow from all 
</Directory> 

ErrorLog ${APACHE_LOG_DIR}/error.log 

# Possible values include: debug, info, notice, warn, error, crit, 
# alert, emerg. 
LogLevel warn 

CustomLog ${APACHE_LOG_DIR}/access.log combined 
:阿帕奇的
默認文件

回答

1

ErrorDocument docs

URL可以與本地網絡路徑(相對於 的DocumentRoot)斜槓(/)開頭,或者是它的客戶端可以解決一個完整的URL。 或者,可以提供一條消息,以便 瀏覽器顯示。

sites/errorsites/404.html不以w/a斜線開始,因此被視爲要顯示的消息。更改爲/sites/errorsites/404.html應該修復,如果sites是相對於您的DocumentRoot ...

+0

謝謝! :-) Awwwh這樣一個愚蠢的錯誤... –