【发布时间】:2016-09-25 00:06:19
【问题描述】:
【问题讨论】:
-
你用的是什么版本的apache?
-
@Panama Jack 不知道,上一版MAMP提供的那个
【问题讨论】:
你可以这样试试。阻止除 localhost 或 server IP address 之外的所有 php 文件。
对于 Apache
<Files ~ "\.php">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files "index.php">
Order Allow,Deny
Allow from all
</Files>
对于 Apache >= 2.4
<Files ~ "\.php">
Require all denied
Require ip 127.0.0.1
</Files>
<Files "index.php">
Require all granted
</Files>
Mamp 应该使用 Apache 2.4,所以第二个示例应该可以工作。
【讨论】: