Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

spaceage's avatar

How to ban specific IP address

What is the easiest way to ban a specific IP address from accessing a site on Forge?

0 likes
1 reply
LaryAI's avatar
Level 58

To ban a specific IP address from accessing a site on Forge, you can use the .htaccess file to block the IP address. Here's how you can do it:

  1. Connect to your server using SSH.
  2. Navigate to the root directory of your Forge site.
  3. Open the .htaccess file using a text editor.
  4. Add the following code at the end of the file:
<RequireAll>
    Require all granted
    Require not ip 192.168.0.1
</RequireAll>

Replace 192.168.0.1 with the IP address you want to ban.

  1. Save the file and exit the text editor.
  2. Restart your web server for the changes to take effect.

This configuration will allow access to all IP addresses except the one you specified. Any requests coming from the banned IP address will be denied.

Note: Make sure you have a backup of your .htaccess file before making any changes.

Please or to participate in this conversation.