在.htaccess文件验证Googlebot的文件、htaccess、Googlebot

由网友(小清新自然的森系)分享简介:我已经调查了一下。将$下面的工作C $ C吗?没那么容易检查。 I have been investigate a bit. Will code below work? Not so easy to check. RewriteEngine onHostnameLookups Double RewriteCo...

我已经调查了一下。将$下面的工作C $ C吗?没那么容易检查。

I have been investigate a bit. Will code below work? Not so easy to check.

RewriteEngine on
HostnameLookups Double  
RewriteCond %{REMOTE_HOST} (.googlebot.com) [NC] 
RewriteRule ^(.*)$ /do-something [L,R]

我担心最多的部分。

I worry the most for part

HostnameLookups Double 

报告说,在这只能在httpd.confg一些地方,VPS,目录(而不是舒尔这是什么最后的手段,如果没有的.htaccess,但不是说htaccess的)。 你有知识,这个问题?

It says in some place that works only in httpd.confg, vps, directory(not shure what this last means if not .htaccess but not saying in htaccess). Do you have knowledge about this issue?

推荐答案

您可以使用一个条件%{HTTP_USER_AGENT} 变量:

You can use a condition with %{HTTP_USER_AGENT} variable:

RewriteEngine on

RewriteCond %{HTTP_USER_AGENT} ^googlebot
RewriteRule ^(.*)$ /do-something [L,R]

虽然记住,%{HTTP_USER_AGENT} 可以被欺骗。

阅读全文

相关推荐

最新文章