【发布时间】:2015-07-16 23:55:21
【问题描述】:
我想为我的小型网络服务器创建一个自定义错误页面,该服务器在 raspbian 上的 apache2 上运行。但遗憾的是,如果 URL 无法解析,浏览器不会加载创建的页面……浏览器只会在左上角打印创建的错误页面的路径。
到目前为止的自定义页面的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
带有自定义错误站点的错误站点目录的位置:/var/www/sites/
(当然我在 /etc/apache2/sites-available 的默认文件中将“AllowOverride”设置为“all”。)
感谢您的帮助
卢卡斯
编辑: apache的默认文件:
ServerAdmin webmaster@localhost
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
【问题讨论】:
标签: html apache .htaccess apache2