We are often required to restrict access to website using virtual host configurations or by using .htaccess.
In this tutorial, we will see how easy it is to restrict access to website or a particular directory using .htaccess.
To learn about Nginx and apache url rewrite for wordpress, please check this link.
This article is related to .htaccess configuration used in apache version 2.4+ only. Also make sure use of .htaccess is allowed in virtualhost configuration and AllowOverride all is present in config.
To restrict access to website or directory using .htaccess, all you need to do is place an .htaccess in your document root or in directory you want to apply restrictions to respectively.
Require ip 10.10.11.11
Require ip 10.10.11.12
Require ip 10.10.11.13
Require ip 10.10.11.14
This will restrict the access to website from these ips mentioned in the list only.
Hope this will be helpful for some. Thanks and have a great day. 🙂