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
webdevetc

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



More...


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 have a whitelist of IP addresses that can access files in .htaccess

How to return an item in Eloquent, or throw a ModelNotFoundException exception if it isn't found?

How to prevent Eloquent from adding created_at or updated_at timestamps?

What is the difference between ( for ... in ) and ( for ... of ) in javascript?

How to force gzip compression in Apache with .htaccess

How to block IP addresses in Apache by using regular expressions (regex) in .htaccess

How to create random numbers in JS?

How to round a number in JS?

How to find the index of a value in an array in JS?

How to show (or log) all SQL queries executed by Laravel