Can you block a domain from accessing your website?

Suppose you have a website and you want to block access from a certain domain, for example say you wanted to block access to anyone in the aol.com domain. is this possible?

Yes, but you’d need to ban every possible aol.com IP address.

Most web server software does allow this; e.g. for Apache the code in the .htaccess file for your site would be



Order deny,allow
Deny from .aol.com


The downside to specifying the excluded IP addresses by domain name is that your web server must perform a reverse name server lookup every time someone accesses the site (i.e. ask the DNS system what the domain name address corresponding to the IP address is), which might significantly degrade the web server’s performance.