301重定向基于用户代理 [英] 301 redirect based on user-agent
本文介绍了301重定向基于用户代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有我想要做一个通配符301重定向一个域。所有的传入流量应该做301重定向如果用户代理是不是像谷歌,雅虎,必应一个流行的搜索引擎。
如果是谷歌,雅虎或Bing用户代理,它可以返回一个404。
我如何做到这一点?
解决方案
RewriteEngine叙述上的RewriteCond%{HTTP_USER_AGENT}的Googlebot | yahoobot | microsoftbot [NC]
重写规则^ * $ - [R = 404,L]#其他
重定向301 / http://www.somesite.com/
I have a domain that I want to do a wildcard 301 redirect with. All incoming traffic should do a 301 redirect if the user-agent is not a popular search engine like Google, Yahoo, Bing. If it is Google, Yahoo or Bing user agents, it can return a 404.
How do I do this?
解决方案
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} googlebot|yahoobot|microsoftbot [NC]
RewriteRule ^.*$ - [R=404,L]
#else
Redirect 301 / http://www.somesite.com/
这篇关于301重定向基于用户代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文