In order to limit access to the directory for all IP except one, you need to put in it .htaccess with the following content:
Order Deny,Allow Deny from all Allow from 1.1.1.1
You can do this in virtual hosts in this way.
<Directory "/var/www/html/mysite/my_folder"> Order Deny,Allow Deny from all Allow from 1.1.1.1 </Directory>
But how to solve this problem if there is no my_folder directory and this is a virtual path?
The following is the contents of the .htaccess directory mysite
/var/www/html/mysite/.htaccess:
AddDefaultCharset utf-8 Options +FollowSymLinks IndexIgnore */* RewriteEngine on RewriteRule ^favicon.ico$ - [F,L] # если директория или файл существуют, использовать их напрямую RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # иначе отправлять запрос на файл index.php #RewriteRule . index.php <-- было RewriteRule ^([^/].*)$ /index.php/$1 [L] # <-- стало