Hi im trying to get some basic rules in htaccess working but not having much luck.
At the top of my file I want to block certain IP's and certain user agents so I have
## block specific IPs
Order Deny,Allow
Deny from 62.210.122.209
Deny from 109.184.114.247
## stop requests with user agent that includes these texts
BrowserMatchNoCase "xyz" bad_bot
Deny from env=bad_bot
this works fine on its own however I also need to stop all php scripts being accessed except for index.php and index2.php
## stop all php files from being accessed
<Files *.php>
deny from all
</Files>
## except for index and index2
<Files ~ "^index(2)?\.php$">
allow from all
</Files>
but once I add this I get partial access to the site even with my user agent containing xyz
/index.php is blocked but /administrator/index.php is still open to me
找到答案..只需在第一部分中使用环境变量设置来拒绝第二部分中index.php的files指令下的访问。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.