apache 屏蔽IP段访问

打开httpd.conf文件

Documentroot

<Directory "你的网站根目录">

Options Indexes FollowSymLinks

AllowOverride None

Order deny,allow

Deny from 192.168.1.99

</Directory>

修改AllowOverride None 为AllowOverride All  表示为开启.htaccess

之后在网站根目录下创建.htaccess文件,写入

Order allow,deny  
Allow from all  
Deny from 112.110.0.0/255.255.0.0      //禁止112.110.x.x IP段所有IP

原文地址:https://www.cnblogs.com/haohaosky/p/5116776.html