0 $0.00
Block IP Addresses or Referring Domains
Category: X-Cart Snippets
Added:
A quick and easy method to block specific or ranges of IP addresses or referring domains, via your root .htaccess file. <Limit GET POST> order allow,deny # Block a single IP deny from 123.456.789.012 # Block a few deny from 123.456.789.012 deny from 123.456.789.012 deny from 123.456.789.012 # Block a range deny from 123.456. allow from all </Limit> Block and send elsewhere... RewriteCond %{REMOTE_ADDR} ^11\.22\.33\.44 RewriteRule ^/* https://www.google.com [R=301,L] Or an IP range... RewriteCond %{REMOTE_ADDR} ^11\.22\.33\. RewriteRule ^/* https://www.google.com [R=301,L] Or referring domains... RewriteCond %{HTTP_REFERER} .*whatever.com.*$ [OR] RewriteCond %{HTTP_REFERER} .*whatever.org.*$ [OR] RewriteCond %{HTTP_REFERER} .*whatever.net.*$ RewriteRule ^(.*)$ https://google.com [R=301,L] If you'd like to be able to block by country, try this mod. |