How to deny access to a single IP Address using .htaccess

Last modified: January 18, 2025
You are here:
Estimated reading time: < 1 min

Let’s say you want to block access to your website from the IP address 1.2.3.4. The following lines allow access to your site for all users, except for the one with the IP address 1.2.3.4.

# Order Allow, Deny

Deny from 1.2.3.4

Deny from 1.2.3.5
Allow from All

# Order Deny, Allow

Deny from 1.2.3.4

Deny from 1.2.3.5
To block access from multiple IP addresses, just include as many ‘Deny from’ directives as necessary.
Was this article helpful?
Dislike 0
Views: 25

Braw Hosting Sales

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.

Scroll to Top