ItSolutionStuff.com

How to Whitelist/Allow IP Address using .htaccess File?

By Hardik Savani • January 12, 2022
Ubuntu .htaccess Server

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.

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:

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...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

šŸ“ŗ Subscribe on YouTube

We Are Recommending You

ā˜…

Laravel Connect Remote Database using SSH Tunnel Example

Read Now →
ā˜…

How to Clone Laravel Project from Github on Server?

Read Now →
ā˜…

How to Generate and Add SSH Key in Gitlab?

Read Now →
ā˜…

How to Check Apache Access & Error Log Files in Ubuntu Server?

Read Now →
ā˜…

How to Whitelist/Allow IP Address in Apache Ubuntu?

Read Now →
ā˜…

How to Restrict/Block IP Address in Apache Ubuntu?

Read Now →
ā˜…

How to Set Up Password Authentication with Apache in Ubuntu?

Read Now →
ā˜…

How to Install Composer in Ubuntu Server?

Read Now →
ā˜…

How to Install Apache PHP MySQL and Phpmyadmin on Ubuntu?

Read Now →
ā˜…

How to Install Phpmyadmin in Ubuntu Server?

Read Now →