我需要加载示例错误页面: - 对于我的abc.com站点
我编辑了站点主目录中的.htaccess文件(比如abc)文件根目录是/ opt / lampp / htdocs,并在.htaccess文件中给了 ErrorDocument 404 /opt/lampp/htdocs/abc/404.html 这一行 .
但仍然显示
该怎么办?
根据HTTPD documentation for ErrorDoument,文件的路径必须相对于配置的 DocumentRoot ,即 . 如果 /opt/lampp/htdocs/abc/404.html 是您要使用的文件,且 DocumentRoot 设置为 /opt/lampp/htdocs ,则必须使用 ErrorDocument 404 /abc/404.html .
DocumentRoot
/opt/lampp/htdocs/abc/404.html
/opt/lampp/htdocs
ErrorDocument 404 /abc/404.html
如果要在 .htaccess 文件中设置 ErrorDocuent ,则必须确保为 .htaccess 文件存储的目录设置了 AllowOverride FileInfo .
.htaccess
ErrorDocuent
AllowOverride FileInfo
这是一个现场网站,你去过网站托管网站?应该有一个404错误选项,您可以在标准错误或自定义错误页面之间进行选择 .
修复了检查错误日志的问题 . 路径不同 .
[2013年9月12日12:53:18] [错误] [客户端203.200.152.157]文件不存在:/ opt / lampp / htdocs / abc / af; ldkjf
[Thu Sep 12 12:53:18 2013] [错误] [client 203.200.152.157]文件不存在:/opt/lampp/htdocs/404.html
我在.htacess中给出了这个并检查: -
ErrorDocument 404 "/abc/404.html"
现在页面加载正常,如果我们给http://abc.com/anything-ddfsd
3 回答
根据HTTPD documentation for ErrorDoument,文件的路径必须相对于配置的
DocumentRoot
,即 . 如果/opt/lampp/htdocs/abc/404.html
是您要使用的文件,且DocumentRoot
设置为/opt/lampp/htdocs
,则必须使用ErrorDocument 404 /abc/404.html
.如果要在
.htaccess
文件中设置ErrorDocuent
,则必须确保为.htaccess
文件存储的目录设置了AllowOverride FileInfo
.这是一个现场网站,你去过网站托管网站?应该有一个404错误选项,您可以在标准错误或自定义错误页面之间进行选择 .
修复了检查错误日志的问题 . 路径不同 .
[2013年9月12日12:53:18] [错误] [客户端203.200.152.157]文件不存在:/ opt / lampp / htdocs / abc / af; ldkjf
[Thu Sep 12 12:53:18 2013] [错误] [client 203.200.152.157]文件不存在:/opt/lampp/htdocs/404.html
我在.htacess中给出了这个并检查: -
ErrorDocument 404 "/abc/404.html"
现在页面加载正常,如果我们给http://abc.com/anything-ddfsd