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 "[B]dyndnsname.dyndnshost.com[/B]". Simply [B][U]change it to your[/U][/B] own.
Place a file named "[B].htaccess[/B]" in the admin folder.
Like this:
[B]/www/bitrix/admin/.htaccess[/B]
The content:
[CODE]# 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>[/CODE]
The code ensures that all files and subdirectories in [B]/bitrix/admin/*[/B] are only accessible from the IP address resolved using the DDNS name. The file [B]/bitrix/admin/user_options.php[/B] is defined as an exception to this restriction.
Cheers!
In the example code, we use the address "[B]dyndnsname.dyndnshost.com[/B]". Simply [B][U]change it to your[/U][/B] own.
Place a file named "[B].htaccess[/B]" in the admin folder.
Like this:
[B]/www/bitrix/admin/.htaccess[/B]
The content:
[CODE]# 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>[/CODE]
The code ensures that all files and subdirectories in [B]/bitrix/admin/*[/B] are only accessible from the IP address resolved using the DDNS name. The file [B]/bitrix/admin/user_options.php[/B] is defined as an exception to this restriction.
Cheers!