Short Link: https://blog.m3server.com/?p=90
Add the following lines to your .htaccess file in your root directory, or the directory that you wish to protect. Adding to a directory will protect that directory and all directories below it.
Deny from 123.55.
Deny from 123.45.2.
Deny from 220.127.116.11
Allow from all
Please note, those are example IP addresses, not real ones!
Add this to your .htaccess file, or create one if you do not have one with your favorite text editor, upload the file to the server into the directory you wish to protect.
This will allow any ip to access your site, except those listed. You can add as many as you wish. Note the 2nd example, 123.45.2 – this will block the full class C, from 18.104.22.168 to 22.214.171.124
Again, test it to ensure this is the effect you want. At any time, you can remove the .htaccess file, or rename it to, example, off.htaccess and it will disable any rules you have specified.