问题原文
原帖链接 · user281497 · CC BY-SA 3.0
My IP changes do a different D class, so I want to set a range:
123.123.123.xxx where the last segment can be 0-255.
Right now, Apache says:
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
社区高分解答
原帖链接 · Frank N · CC BY-SA 4.0
In Apache 2.2 and below, you could work with:
Order deny,allow
Deny from all
Allow from 24.18 # allow access from home
Allow from 162.12 # allow access from work
in your .htaccess, directly on base level (not within any <directive>).
As of Apache 2.4 and above, here you go:
<RequireAny>
#IPv4 range at my work
Require ip 207.100
#IPv4 range I usually get through my mobile provider
Require ip 29.11
#IPv6 from home
Require ip 2a02:4126:2aa4::/48
</RequireAny>
(all numbers fictional, no worries ;-).
I have been using this for many years now to shield my back end folders against 99% of potential users. (Working very well, unless you are an avid blogger while traveling. If you are a gmail user: “last account activity” Link at the very bottom is a comfy way to figure out your own “IP habits”).
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
