是否可以通过 IIS 中的 web.config 阻止对目录的访问(不包括一小组 IP),但允许每个人通过一个特定文件。
我问的原因是,我想阻止 WordPress 中的 wp-admin 目录,但 admin-ajax.php 确实需要可以从外部访问。
谢谢。
为了将来参考,这是解决方案:
<location path="wp-admin">
<system.webServer>
<security>
<ipSecurity allowUnlisted="false">
<clear/>
<add ipAddress="ipaddr" allowed="true" />
</ipSecurity>
</security>
</system.webServer>
</location>
<location path="wp-admin/admin-ajax.php">
<system.webServer>
<security>
<ipSecurity allowUnlisted="true">
</ipSecurity>
</security>
</system.webServer>
</location>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3390 次 |
最近记录: |