Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess: Allow from domain name instead of IP/subnet

Tags:

.htaccess

On my Authentication page i have it only allow from certain IPs. Is it possible to have it allow by a domain name? The IP of my home network is dynamic but the domain name (mysite.com) always points to the correct IP address.

like image 637
Bijan Avatar asked Sep 12 '25 04:09

Bijan


1 Answers

I came across this because I had the same problem.

Just in case anyone else finds this, I found the perfect solution:

Beginning in Apache 2.4.19, you can use the parameter "Require forward-dns [hostname]", which simply allows all IPs behind [hostname].

https://httpd.apache.org/docs/2.4/mod/mod_authz_host.html#requiredirectives

like image 188
Norman Avatar answered Sep 16 '25 10:09

Norman