User_agent can be used as a browser logo, the current mainstream browser has IE, Chrome, Firefox, 360, the iphone Safari, Android phone Baidu search engine, Google search engine, and so on, each browser has a corresponding User_agent, a few common user_agent are listed below.
mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; trident/4.0;. net4.0c;. net4.0e; SE 2.x)
mozilla/5.0 (Windows NT 5.1) applewebkit/537.36 (khtml,like Gecko) chrome/31.0.1650.63 safari/537.36
mozilla/5.0 (compatible; baiduspider/2.0; +http://www.baidu.com/search/spider.html)
mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; WOW64; trident/4.0; SLCC2;. NET CLR 2.0.50727;. NET CLR 3.5.30729;. NET CLR 3.0.30729; Media Center PC 6.0;. net4.0c;. net4.0e; infopath.3; 360SE)
Make some restrictions on user_agent.
The configuration is as follows:
<ifmodule mod_rewrite.c>
Rewriteengine on
Rewritecond%{http_user_agent} ^*firefox/4.0* [Nc,or]
Rewritecond%{http_user_agent} ^*tomato bot/1.0* [NC]
Rewriterule. *-[F]
</IfModule>
Also use the rewrite module to implement the restriction specified user_agent, in this case, Rewriterule. *-[F] can be directly forbidden to access, Rewritecond with User_agent to match, *firefox/4.0* said, as long as US The er_agent contains firefox/4.0 to match the criteria, where * denotes any character, NC means case insensitive, or indicates or joins the next condition. If you want to limit Baidu's search engine, you can add a rule like this:
Rewritecond%{http_user_agent} ^*baiduspider/2.0* [NC]
Rewriterule. *-[F]
Since there is or OR, it has to be and, as long as you do not write or is and mean.
This article is from the "Learn Notes for students" blog, please make sure to keep this source http://sanyisheng.blog.51cto.com/11154168/1795826
Lamp--apache prohibit designation of User_agent