我只想允许我的 IP 地址访问 wp-admin,但同时又不想阻止对 admin-ajax.php 的调用。所以我想将 admin-ajax.php 列入白名单。.htaccess 中的以下代码(放置在 wp-admin 目录中)是否实现了这些目标:
#Protect wp-admin
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "WordPress Admin Access Control"
AuthType Basic
< LIMIT GET>
order deny,allow
deny from all
allow from < my IP address>
< /LIMIT>
#Allow access to wp-admin/admin-ajax.php
< Files admin-ajax.php>
Order allow,deny
Allow from all
Satisfy any
< /Files>