Apache prohibits the designation of user_agent

Source: Internet
Author: User



Apache Forbidden to specify user_agent



User_agent We call it the browser logo, the current mainstream browser has IE, Chrome, Firefox, on the iphone safari, Android phone, Baidu search engine, Google search engine and so many, Each browser has a corresponding 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>



It is also possible to 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 the user_agent contains firefox/4.0 in the condition, where * denotes any character, NC means case-insensitive, or represents or, joins the next condition. If I want to limit Baidu's search engine now, can add one such rule:



Rewritecond%{http_user_agent} ^.*baiduspider/2.0.* [NC]



Rewriterule. *-[F]



[Nc,or] It means yes or no; [NC] meaning yes and.






This article from "12350027" blog, declined reprint!



Apache prohibits the designation of user_agent


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.