Solved

Need help writing simple .htaccess function for IIS - Block websites from site access

Posted on 2013-12-18
2
173 Views
Last Modified: 2014-08-28
Hi,

The below code is some code for a .htaccess file, which when used will provide a 403 FORBIDDEN error when badsite.com or anotherbadsite.com tries to access our website.

Unfortunately we are running IIS so can't just use the below - Is there anyone out there who can provide the code to do the same thing for an IIS Web.config  ??

     RewriteEngine on 
    # Options +FollowSymlinks 
    RewriteCond %{HTTP_REFERER} badsite\.com [NC,OR] 
    RewriteCond %{HTTP_REFERER} anotherbadsite\.com 
    RewriteRule .* - [F]
 

Open in new window

0
Comment
Question by:ChilliSauce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39728434
Here is the download for URL Rewrite for IIS 7 and above: http://www.iis.net/downloads/microsoft/url-rewrite
0
 
LVL 16

Accepted Solution

by:
CWS (haripriya) earned 500 total points
ID: 39728449
In IIS server, you should be able to do this in web.config file.

The below code restricts access by IP address.

<security>
   <ipSecurity allowUnlisted="true">    <!-- this line allows everybody, except those listed below -->            
       <clear/>     <!-- removes all upstream restrictions -->                
       <add ipAddress="83.116.19.53"/>     <!-- blocks the specific IP of 83.116.19.53  -->                
       <add ipAddress="83.116.119.0" subnetMask="255.255.255.0"/>     <!--blocks network 83.116.119.0 to 83.116.119.255-->                
       <add ipAddress="83.116.0.0" subnetMask="255.255.0.0"/>     <!--blocks network 83.116.0.0 to 83.116.255.255-->                
       <add ipAddress="83.0.0.0" subnetMask="255.0.0.0"/>     <!--blocks entire /8 network of 83.0.0.0 to 83.255.255.255-->                
   </ipSecurity>
</security>

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
website cert not being shown even complete cert request is successful. 2 27
asp web application 3 43
IDE for Python 5 73
Help to debug powershell script 5 44
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to dynamically set the form action using jQuery.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question