March 2020
Beginner
660 pages
18h 28m
English
We can use the .htaccess file or custom PHP coding to limit site access to a set of allowed IP addresses to prevent unauthorized users from accessing the site. In this recipe, we used htaccess methods to block access and grant access to certain IPs.
We started by blocking the entire site including the frontend of the site by adding the following piece of code to the top of the .htaccess file:
order deny,allowdeny from allallow from 112.145.233.142
order, deny and allow are three directives used in .htaccess files to define the rules. The deny directive blocks access while the allow directive provides access. The order directive specifies the order in which the other directives are executed. In this case, deny rules will be ...
Read now
Unlock full access