How to block multiple IP addresses in .htaccess

Apache: How to block multiple IP addresses in .htaccess

If you need to block more than one IP address you can do this quite easily. Put each one of the IP addresses next to each other with a space in between.

  1. Deny from x.x.x.x y.y.y.y z.z.z.z

(Replace the x.x.x.x / y.y.y.y / z.z.z.z with the IP addresses that you wish to block access to)

webdevetc profile pic

I am a 29 year old backend web developer from London, mostly focusing on PHP and Laravel lately. This ( is my blog where I write about some web development topics (PHP, Laravel, Javascript, and some server stuff). contact me here.


Comments and discussion about How to block multiple IP addresses in .htaccess

Found this interesting? Maybe you want to read some more in this series?

Or see other topics in the Apache language

Or see other languages/frameworks:
PHP Laravel Composer Apache CentOS and Linux Stuff WordPress General Webdev and Programming Stuff JavaScript
Or see random questions

How to add a name prefix to all routes in a group?

How to disable file hotlinking in Apache with .htaccess

How to add the CSRF (Cross-site request forgery) token in Laravel?

How to get the type of a variable in JS?

How to get table column names from a database table in Eloquent?

What are some ways you can log debug messages and data in JS?

How to prevent Eloquent from adding created_at or updated_at timestamps?

How to remove .php from the end of URLs with .htaccess

How to group a SQL statement in brackets/parenthesis

What is the loop variable in a @foreach loop in Blade?