访问控制FilesMatch
filesMatch针对链接进行控制。
[root@chy ~]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
<Directory /data/wwwroot/111.com>
<FilesMatch admin.php(.*)>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</FilesMatch>
</Directory>
(增加的配置有<FilesMatch admin.php(.*)> </FilesMatch> 必须是成对出现 )
测试结果:[root@chy 111.com]# curl -x127.0.0.1:80 'http://www.111.com/admin.php?/dddjjjlllsahog' -I
HTTP/1.1 404 Not Found
Date: Thu, 03 Aug 2017 16:48:12 GMT
Server: Apache/2.4.27 (Unix) PHP/5.6.30
Content-Type: text/html; charset=iso-8859-1
[root@chy 111.com]# curl -x192.168.212.10:80 'http://www.111.com/admin.php?/dddjjjlllsahog' -I
HTTP/1.1 403 Forbidden
Date: Thu, 03 Aug 2017 16:48:35 GMT
Server: Apache/2.4.27 (Unix) PHP/5.6.30
Content-Type: text/html; charset=iso-8859-1
(这里访问的域名必须是servername 后面跟的域名)