Block IP Addresses or Referring Domains

Block IP Addresses or Referring Domains

A quick and easy method to block specific or ranges of IP addresses or referring domains, via your root .htaccess file.

Share

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 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.

: *
: *
: *
Type the characters you see in the picture:
Captcha

*
Change next order ID value

Change next order ID value

If you've just opened a new store, you may not want customers to see low order ID's.

Protect company emails from spambots

Protect company emails from spambots

This will encode your company email addresses...

Detect HTTPS mode in Smarty

Detect HTTPS mode in Smarty

If you get a security alert when in secure mode, it's usually due to offsite elements such as SSL certificate seals, images and javascript that are not secure, in which case you can fix with this code...

More...