Lamp-apache prohibit designation of User_agent

Source: Internet
Author: User

Websites sometimes have illegal visits or meaningless visits, such as garbage spiders (Spider-Spider, Sogou spider, etc.), and when the site visits are large, spiders ' access increases the burden on the server and loses performance. For not necessary search engines, can be banned, and for Baidu, Google, etc. can be retained


prohibited Search Engine method: through the rewrite module implementation, such as the ban Sogou spider access to the site, add the following red field

<ifmodule mod_rewrite.c>

Rewriteengine on

Rewritecond%{http_host} ^www.aaa.com$ [OR]

Rewritecond%{http_host} ^www.bbb.com$ [OR]

Rewritecond%{http_host} ^www.ccc.com$

Rewriterule ^/(. *) $ http://www.test.com/$1 [r=301,l]

Rewritecond%{http_user_agent} ^.*sogou.* [NC]

Rewriterule. *-[F]

</IfModule>

Description: [NC] means case insensitive, [F] means forbidden forbidden


Try to use Sogou browser to visit any page of the site will show 403 Forbidden, so don't worry about garbage spider trouble


This article is from the "Parody Games" blog, so be sure to keep this source http://kevinjin117.blog.51cto.com/11655131/1835360

Lamp-apache prohibit 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.