Skip to main content

Blocking an IP address on your Joomla website

Of course, it is possible to deny a particular IP address access to your Joomla site.

Reasons could be:

  • Someone is trying to hack your website.
  • Someone is copying content from your website.
  • Someone is linking to images or other media on your website.
  • Someone attacks your website with many requests.
  • Someone continuously spamming your website.

You can deal with this in several ways.

Block an IP address with Akeeba Admin Tools PRO

You can block an IP address using an extension such as the PRO version of Akeeba Admin Tools.

Through the Web Application Firewall, you can also automate things. For example, you can have a particular IP address blocked after X number of failed login attempts. (Note that you may also potentially be blocked yourself if you don't add your IP address to the Whitelist.)

Blocking an IP address in the .htaccess file

You can block an IP address by adding it to the .htaccess file.

- Connect to your website via FTP
- Download the file named .htaccess
- Add the following lines to the .htaccess file:

order allow,deny
deny from 12.34.567.890
allow from all

If you are being attacked by multiple IP addresses you can add as follows

order allow,deny
deny from 12.34.567.890
deny from 12.34.567.891
allow from all

 

Now let's assume you are being attacked by a range of IPs, for example all IPs starting with 12.34.567, here is what you need to do:

order allow,deny
deny from 12.34.567
allow from all

Now the question remains: how do you know what the IPs are that are spamming you? You check your logs and see if there are repeated requests from the same IP address.

Was this helpful? Share it with your friends!
This article was updated on: 24 May 2025

About Jeroen

I have been working with the Joomla! CMS since 2006. Besides building and maintaining Joomla! websites and webshops, I am also familiar with search engine optimization (SEO), Joomla hosting and developing templates and extensions. Furthermore, I am a frequent visitor and speaker at JoomlaDays and various Joomla user groups.

I am committed to the Joomla! community as a member of the Extensions Directory team and the organization of Joomla user group Breda and JoomlaDagen Netherlands. In short: Are you looking for a Joomla Specialist, you should contact me!