我有一个不断更新的网站,问题是,当一个图像不存在了的谷歌机器人的索引网站提供了大量的五百分之四百○四错误或已被删除。这是一个产品目录的网站,让产品被删除,并添加上一个小时计算。
I have a website that is constantly updated and the problem is that the Google bot that indexes the website gives a lot of 404/500 errors when a image does not exist anymore or has been deleted. It's a product catalogue website, so products get deleted and added on a hourly basis.
我已经试过这种重写规则
I've tried this RewriteRule
^/(.*)$ /site/page/view/404 [R=301,L]
这将导致该网站上的所有图像不显示更多或
which causes all images on the website not to display any more or
^(.*) /site/page/view/404 [R=301,L]
这只是给出错误500浏览器。
which just gives error 500 on the browser.
有没有一种方法,以配合不存在的文件/ URL,并永久重定向到不同的URL,例如 /网站/网页/浏览/ 404
Is there a way to match non existent files/urls and redirect them permanently to different url e.g. /site/page/view/404
试试这个的(假设的.htaccess
是Web根)的
Try this (assuming .htaccess
is in web root)
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d # not a dir
RewriteCond %{REQUEST_FILENAME} !-f # not a file
RewriteRule ^.*$ /site/page/view/404 [R=301,L]
另外,你可以使用的ErrorDocument
和
ErrorDocument 404 /site/page/view/404