Server
How To Whitelist/Allow IP Address Using .htaccess File?
Today our leading topic is how to allow ip address htaccess. This post will give you simple example of how to allow ip address in .htaccess. I’m going to show you about whitelist ip address htaccess. Here you will learn htaccess allow ip address.
- 4.5/5.0
- Last updated 08 September, 2022
- By Admin
If you need to allow some ip address for your website then i will help you how to allow ip address using htaccess file. i will give you simple example of whitelist ip address in .htaccess.
let's see code of allow and deny ip address in .htaccess file:
Let's see bellow solution command:
Allow IP Address in .htaccess
Example 1: Allow One IP Address:
Simply create .htaccess file in your root directory and add following code on it.
.htaccess
order deny,allow deny from all allow from 111.111.111.111
Example 2: Allow Multiple IP Addresses:
Simply create .htaccess file in your root directory and add following code on it.
.htaccess
order deny,allow deny from all allow from 111.111.111.111 111.111.111.112 111.111.111.113
You will see layout as like bellow:
Deny IP Address in .htaccess
Example 1: Block One IP Address:
Simply create .htaccess file in your root directory and add following code on it.
.htaccess
deny from 111.111.111.111
Example 2: Block Multiple IP Addresses:
Simply create .htaccess file in your root directory and add following code on it.
.htaccess
deny from 111.111.111.111 111.111.111.112 111.111.111.113
I hope it can help you...