You can also protect the admin area from unauthorized access using .htaccess. For flexibility, you can use DDNS names, for example. DDNS is useful because most users receive dynamic IP addresses from their Internet provider. This allows you to update the permitted IP address without having to constantly edit the .htaccess file.
In the example code, we use the address "dyndnsname.dyndnshost.com". Simply change it to your own.
Place a file named ".htaccess" in the admin folder.
Like this:
/www/bitrix/admin/.htaccess
The content:
The code ensures that all files and subdirectories in /bitrix/admin/* are only accessible from the IP address resolved using the DDNS name. The file /bitrix/admin/user_options.php is defined as an exception to this restriction.
Cheers!
In the example code, we use the address "dyndnsname.dyndnshost.com". Simply change it to your own.
Place a file named ".htaccess" in the admin folder.
Like this:
/www/bitrix/admin/.htaccess
The content:
| Код |
|---|
# Block access to everything in /bitrix/admin/* # except /bitrix/admin/user_options.php # Access is only allowed to the IP resolved by dyndnsname.dyndnshost.com <IfModule mod_setenvif.c> SetEnvIf Request_URI "/bitrix/admin/user_options\.php$" ALLOW_USER_OPTIONS <FilesMatch ".*"> Require forward-dns dyndnsname.dyndnshost.com Order Deny,Allow Deny from all Allow from env=ALLOW_USER_OPTIONS Satisfy any </FilesMatch> </IfModule> |
The code ensures that all files and subdirectories in /bitrix/admin/* are only accessible from the IP address resolved using the DDNS name. The file /bitrix/admin/user_options.php is defined as an exception to this restriction.
Cheers!