You can setup restricted access using htpasswd protection – this allows only those with the password to access the site.
It is possible to block access to your website from either specific IP addresses, a range of addresses, or an entire domain. This is done by creating or modifying a .htaccess file in the root folder of your website to match one of the following formats:
For a specific IP address:
order allow, deny
allow all
deny 169.254.333.236
169.254.333.263 will be unable to view the website. For a range of IP addresses:
order allow, deny
allow all
deny 169.254.333
This will prevent any IPs starting with 169.254.333 from viewing the website, such as 169.254.333.1, 169.254.333.2, etc. For a domain:
order allow, deny
allow all
deny *.spamserv.com
Nobody trying to connecting from spamserv.com will be able to view the website.