Solved

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

Posted on 2013-12-18
2
175 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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

688 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