Directives must be placed in a file .htaccess, located in the directory of the site to which you want to restrict access. Restricted visitors will receive answer 403.
In the example directives:
XXX.XXX.XXX.XXX
Is the IP address for which you want to allow or deny access.admin/login/
Is the page to which access will be restricted. The full address will look like this - http://example.com/admin/login/
.
Restricting access to the entire site using directives Order Allow,Deny
:
Order Deny,Allow Deny from all Allow from XXX.XXX.XXX.XXX
Restricting the page using directives Rewrite
:
RewriteEngine on RewriteCond %{REMOTE_ADDR} !^XXX\.XXX\.XXX\.XXX$ RewriteRule ^admin/login/? - [F,NC]
Site-wide restriction using directives Order Allow,Deny
:
Order Allow,Deny Allow from all Deny from XXX.XXX.XXX.XXX
Restricting the page using directives Rewrite
:
RewriteEngine on RewriteCond %{REMOTE_ADDR} ^XXX\.XXX\.XXX\.XXX$ RewriteRule ^admin/login/? - [F,NC]