How to close the admin directory in Kohana?

Good day.
Is there a site to kohana 3.2
It is necessary to close access to the admin interface (www.site.ru/admin) for it was accessible only from certain IP addresses. If it physically existed at the root of the admin folder, it would be solved simply by adding htaccess with Deny Directive. But as this folder does not exist, and the whole admin panel lies in the __application/classes/...
Tried to pour in each folder admin here c htaccess blocking access, but zero sense. site.ru/admin still open

Please tell me how can I solve this issue?
Option with htpasswd will not work. Need to open access with only one IP
July 2nd 19 at 17:36
2 answers
July 2nd 19 at 17:38
I think that the best solution is to check the IP in the controller, right in the beginning of the function-handler. Hardcoding IPS is not required, it is possible to make a config.
Thanks for the reply. The only problem is that I have no idea how to code here. To solve things at the level of system administration - Yes. To code in php - unfortunately, no.
If there are any manuals where I can learn how to restrict access through coding, then I would appreciate a link. - nikita.Stracke commented on July 2nd 19 at 17:41
Try to register it in the root htaccess:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} /admin
RewriteCond %{REMOTE_ADDR} ^111.111.111.111
RewriteRule ^.*$ /no-access.php [R=302,L]

where
/admin is the URL you want to close
111.111.111.111 - IP, which should zablocie
/no-access.php the page you want to show instead of /admin - shana_Haley commented on July 2nd 19 at 17:44
: Thanks for the info. Here, rather, you want to block all but certain addresses. - nikita.Stracke commented on July 2nd 19 at 17:47
July 2nd 19 at 17:40
To check the IP in the admin controller and if not that, then issue a 404. Or make it check in the root .htaccess .

Find more questions by tags htaccessApacheKohana