Apache, IIS6, ii7 masking Limited IP access (for virtual hosts)

Source: Internet
Author: User

Note: Revise according to requirement (8.8.4.4|8.8.8.) IP range


Linux rules file. htaccess (create. htaccess files manually to the site root directory)


<ifmodule mod_rewrite.c>
Rewriteengine on
#Block IP
Rewritecond%{http:x-forwarded-for}&%{remote_addr} (8.8.4.4|8.8.8.) [NC]
Rewriterule (. *)-[F]
</IfModule>

Windows2003 under


http://faq.myhostadmin.net/faq/listagent.asp?unid=795 First press This tutorial to open rewrite, and then add the following rules.
#Block IP
Rewritecond%{http_x_forwarded_for}&%{remote_addr} (8.8.4.4|8.8.8.) [NC]
Rewriterule (. *)-[F]


windows2008 the Rules file Web.config (create Web.config files to the site root directory manually)


<?xml version= "1.0" encoding= "UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name= "Band IP" stopprocessing= "true" >
<match url= "(. *)"/>
<conditions logicalgrouping= "Matchany" >
<add input= "%{http_x_forwarded_for}&amp;%{remote_addr}" pattern= (8.8.4.4|8.8.8.) "/>
</conditions>
<action type= "Abortrequest"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

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.