【发布时间】:2016-08-15 15:16:29
【问题描述】:
我已经使用 cakephp 控制器设置了 404 页面,当我尝试转到一个不存在的页面时它工作正常,它返回 http 响应 404 并显示 404 页面,但是像 woorank.com 和PowerSeo 总是说没有定义自定义的 404 页面?
我可以在 .htaccess 文件中做些什么来让这些工具知道我定义了 404 页面吗?我已将 ErrorDocument 404 /404.html 添加到 .htaccess 但仍然是相同的错误。他们在哪里寻找定义的 404 页面?
.htaccess 文件
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* – [F,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domain.com [L,R=301]
</IfModule>
ExpiresActive On
ExpiresByType text/html "access plus 1 day"
ExpiresByType image/gif "access plus 10 years"
ExpiresByType image/jpeg "access plus 10 years"
ExpiresByType image/png "access plus 10 years"
ExpiresByType text/css "access plus 10 years"
ExpiresByType text/javascript "access plus 10 years"
ExpiresByType application/x-javascript "access plus 10 years"
Header unset Pragma
Header unset ETag
FileETag None
ErrorDocument 404 /404.html
【问题讨论】: