This process is useful if you have information on your website that you only want certain people to see. To set this up, you will need to create a .htaccess file:
Open Notepad or a similar text editor.
Copy and paste the following text into your new .htaccess file:
<Limit GET HEAD POST>
deny from 18.104.22.168
deny from 159.64.9.
allow from all
In your .htaccess file, amend the above code, changing the IP addresses to suit your needs. Each command should be on a separate line.
Save the file with the file name .htaccess.
Ensure that the file type is set to All Files.
Tip: You can deny access based upon an IP address or an IP block. The above process blocks access to the site from 22.214.171.124, and from any subdomain under the IP block 159.64.9. (126.96.36.199, 188.8.131.52, etc.). This can be very useful if there is another site linking directly to your images or content.
You can set an option for Deny From All, which would deny everyone access. You can also allow or deny access by domain name rather than IP address (Allow From .123-reg.co.uk works for www.123-reg.co.uk or support.123-reg.co.uk, etc).