FozoLA

Registered
Dec 14, 2020
1
0
1
Hungary
cPanel Access Level
Root Administrator
Hello!

I would like to setup an ip based restriction for a website by allowing the given ip addresses in apache’s configuration instead of using .htaccess. Is this possible?
Thanks in advance.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,810
895
313
cPanel Access Level
Root Administrator
Hey there! You could always add this configuration to an Apache include, using the same syntax as what would normally go in a .htaccess file. For example, the cPanel >> IP Blocker tool creates an entry inside the user's .htaccess file that looks like this:

Code:
<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 1.2.3.4
You could add similar code to an include file using the details here: Modify Apache Virtual Hosts with Include Files | cPanel & WHM Documentation

I hope that helps!