2

显然,Bingbot 在我的网站上陷入了无限循环。它下载像http://www.htmlcodetutorial.com/quicklist.html/applets/applets/applets/applets/applets/applets/applets/applets/applets/applets/applets/applets/applets/applets/sounds/forms/这样的页面链接/框架/文档/链接/图像/_AREA_onMouseOver.html。由于我将服务器设置为将 .html 解释为 PHP,因此该页面只是http://www.htmlcodetutorial.com/quicklist.html的副本。 如何阻止 Bingbot 寻找这些伪造的副本?

为什么 Bingbot 开始寻找这些页面?

我想做一些类似下面显示的 .htaccess 文件的最后一行的事情(比如“使用 mod_rewrite 重定向到 Apache 内置 404 页面? ”),但是当我尝试RewriteRule ^.*\.html\/.*$ - [R=404]整个站点时显示 500 错误。

即使我使用下面的最后一行,它也会重定向到http://www.htmlcodetutorial.com/home/htmlcode/public_html/help.html这不是我想要的。

AddType application/x-httpd-php .php .html

RewriteEngine on 
Options +FollowSymlinks

RewriteRule ^help\/.* help.html [L]

RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.htmlcodetutorial.com/$1 [R=301,L]

ErrorDocument 404 /404.html

RewriteRule ^.*\.html\/.*$ help.html [R=301]

PS我知道该网站已经过时了。

4

2 回答 2

0

将您的最后一条规则更改为:

RewriteRule ^(.+?\.html)/.+$ - [R=404,L,NC]
于 2013-11-26T09:55:35.107 回答
0

这里的问题是您要么已Multiviews打开,要么 apache 正在将请求解释/quicklist.html/blah/blah为 PATH_INFO 样式请求,这将被解释为有效请求。

因此,通过将选项行更改为:

Options +FollowSymlinks -Multiviews

然后将您的最后一条规则替换为:

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^ - [L,R=404]
于 2013-11-26T15:37:49.253 回答