How to block IPs with .htaccess

How to block IPs with .htaccess

Overview
This article details how to block IPs specific to various countries from accessing your site.

Notes

  • If you do not have experience in dealing with .htaccess files, we highly recommend that you contact Nexcess support for assistance. An improperly handled .htaccess file can cause major problems for your website.
  • Always back up your .htaccess file before making changes to it.

How to block malicious IPs

Within your .htaccess file, either locate the "allow from" list, or create one if necessary. Follow the outline below to add IP addresses:

Order allow,deny
deny from xxx.xxx.xxx.xxx
deny from xxx.xxx.xxx.xxx
deny from xxx.xxx.xxx.xxx
allow from all

These block lists are convenient for blocking countries or areas known for fraudulent orders or traffic-increasing automated bots.   

 

For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
What is .htpasswd?
Added on Mon, Nov 10, 2014
Creating and managing custom error pages
Added on Tue, Jul 30, 2013
How to redirect a non-WWW web address to a WWW web address
Added on Fri, Aug 2, 2013
How to create and manage MIME types
Added on Tue, Aug 6, 2013
How to enable and disable .htaccess files with SiteWorx
Added on Mon, Aug 5, 2013
How to create .htaccess files
Added on Fri, Aug 2, 2013
How to manage index files
Added on Mon, Aug 5, 2013
.htaccess rewrite commands
Added on Tue, Mar 27, 2018
How to prevent bandwidth theft or Hotlinking
Added on Mon, Aug 5, 2013
How to create URL redirect rules
Added on Tue, Jul 30, 2013