[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

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

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

656 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