Solved

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

Posted on 2013-12-18
2
161 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
2 Comments
 
LVL 82

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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:
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now