Deny access to Joomla Administrator page

Hello everybody
I installed Cyberpanel and I’m trying to block access to the joomla administrator page on a website but without success.
I need to release access to the ip range 10.0.0.0/24 and deny it to everything else.
I tried using .htaccess but it didn’t work

I tried Configuration > vHost Conf > Context
But I only managed to block full access

The code below is not working, what is wrong?

context /administrator/ {
location administrator/
allowBrowse 1
accessAllowed 10.0.0.0/255.255.255.0
accessDenied all
}

Tanks

It seems like you’ve tried to block access to the Joomla administrator page using CyberPanel’s vHost configuration but had no success. Here’s an alternative solution using .htaccess, which you mentioned you tried before.

Create or edit the .htaccess file in the “administrator” folder of your Joomla installation (usually located at /public_html/administrator/ or a similar path) and add the following lines:

RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^10\.0\.0\.
RewriteRule .* - [F,L]

```\

This configuration will deny access to the Joomla administrator page for all IP addresses except those in the 10.0.0.0/24 range.

If you still can't get the .htaccess method to work, make sure that:

1. The Apache mod_rewrite module is enabled on your server. You can usually enable it through your hosting control panel or by asking your hosting provider for assistance.
2. The main .htaccess file in your Joomla installation allows the use of .htaccess files in subdirectories. Look for a line similar to "AllowOverride None" in the main .htaccess file and change it to "AllowOverride All". This might require administrator access to the server.

Keep in mind that this method assumes you are using Apache as your web server. If you're using a different web server, such as Nginx, the process for blocking access to the Joomla administrator page will be different.

Thank you for your attention @mkdangi21
I managed to solve it in a similar way:
Website > List Websites > Manage > Rewrite Rules

 RewriteEngine On
 RewriteCond %{REMOTE_ADDR} !^10\.0\.0\.
 RewriteRule ^administrator/.*$ - [F,L]
1 Like

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.