htaccess - Password protect directory but not files

I'm running a WP+WOO site for a client and thought that a simple way to secure the admin login area would be to pas

I'm running a WP+WOO site for a client and thought that a simple way to secure the admin login area would be to password protect it. The problem is that sometimes (especially on WooCommerce pages) there's one or two files that get called from /wp-admin and this triggers the login popup. I've googled a lot on how to do this with htaccess but I couldn't find anything, and the closes thing I found is 10 years old and is not working for me.

Any ideas on how to achieve this?

I'm running a WP+WOO site for a client and thought that a simple way to secure the admin login area would be to password protect it. The problem is that sometimes (especially on WooCommerce pages) there's one or two files that get called from /wp-admin and this triggers the login popup. I've googled a lot on how to do this with htaccess but I couldn't find anything, and the closes thing I found is 10 years old and is not working for me.

Any ideas on how to achieve this?

Share Improve this question asked Jul 18, 2020 at 23:24 JayJay 111 silver badge5 bronze badges 2
  • 1 Questions about WordPress are out of scope here at Super User – Ramhound Commented Jul 18, 2020 at 23:37
  • You mean /wp-admin/admin-ajax.php ? Yes, that was used for AJAX requests before the new REST API, and it looks like WooCommerce does still use it, yes. Can you make an exception for that in your authentication config? Is there anything else it tries to request? – Rup Commented Jul 19, 2020 at 0:54
Add a comment  | 

1 Answer 1

Reset to default 2

As far as I know, the few files that you are talking about are always going to be the same, that means you can add exceptions to your .htaccess and "let them go through the cracks".

With an example of code from what you wrote so far may help us direct you on how to proceed to do this.

Here is an example of how this is generally done although that uses old code (Allow/Deny) which I don't recommend. It shows you how to change the Deny into an Allow using the <FilesMatch> tag.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742249901a4408945.html

相关推荐

  • htaccess - Password protect directory but not files

    I'm running a WP+WOO site for a client and thought that a simple way to secure the admin login area would be to pas

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信