?
Solved

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

Posted on 2013-12-18
2
Medium Priority
?
184 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 84

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 2000 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

762 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