我想只允许我的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>
1条答案
按热度按时间laawzig21#
你可以整理一下:
像这样就行了: