我有一个问题我遇到了麻烦:/err404 页面的 200OK header 状态问题,尽管它应该是 404 header 。 200 OK 有什么问题?真的有类似 200 OK 应该处于 404 错误页面标题状态的东西吗?
多多指教!!非常感谢!
我猜它与 .htaccess 有关系。这是我的 .htaccess 文件;
ErrorDocument 404 /err404.html
RewriteEngine On
RewriteRule ^login.html$ index.php?s=login&a=loginDo [QSA,L]
RewriteRule ^logout.html$ index.php?s=login&a=logoutDo [QSA,L]
RewriteRule ^([^/]*).html$ index.php?s=$1 [QSA,L]
RewriteRule ^members/([^/]*)$ index.php?s=profile&username=$1 [QSA,L]
RewriteRule ^([^/]*)/$ index.php?s=listing&search[cityString]=$1 [QSA,L]
RewriteRule ^([^/]*)/([^/]*)/$ index.php?s=listing&search[neighborhoodString]=$2 [QSA,L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*).html$ index.php?s=details&seo_friendly=$3 [QSA,L]
我还有一些与此 htaccess 文件相关的麻烦:(
问题一;当 url 类似于 http://localhost/fdfcdcvdvdvbdf.html (不存在的网址),它重定向到主页,但它应该重定向到 err404.html。关于这个问题的任何想法? err404 重定向在类似 http://localhost/fdfcdcvdvdvbdf.ht 的 url 情况下效果很好或 http://localhost/fdfcdcvdvdv
问题2; 我该如何解决这个 200 OK 问题:/
最佳答案
404 值不仅仅是圣诞树的装饰——它传达了有关该 url 的真实信息,即它不存在。发送 200 页描述页面不存在的事实是完全不同的事情,特别是对于程序而言,而不是人类。
关于http - 为什么在 404 错误页面有 200 OK header 状态是不好的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2337737/