gpt4 book ai didi

.htaccess - 如何通过htaccess保护店铺?

转载 作者:行者123 更新时间:2023-12-04 12:23:02 26 4
gpt4 key购买 nike

我想使用 htaccess 身份验证保护来保护 Shopware 6 安装。但是当我在 .htaccess 中设置它时/public 中的文件文件夹我总是在后端(登录后)得到一个“htaccess 循环”,我不能再使用它了。
我试图排除 /api/admin但我对此并不满意。
我该如何解决问题?
/public/.htaccess

AuthName "Prompt"
AuthType Basic
AuthUserFile /home/my-project/.htpasswd
Require valid-user
SetEnvIf REQUEST_URI "(/admin)" ALLOW
SetEnvIf REQUEST_URI "(/api)" ALLOW

<RequireAny>
Require env ALLOW
Require valid-user
</RequireAny>

最佳答案

将此放在您的 public/.htaccess 的开头文件:

AuthType Basic
AuthName "Please login."
AuthUserFile /home/my-project/.htpasswd

<RequireAny>
Require expr %{THE_REQUEST} =~ m#.*?\s+\/api.*?#
Require valid-user
</RequireAny>

// Rest goes here -->

https://issues.shopware.com/issues/NEXT-4243 (德语)
非德语用户的基本翻译:

Ticket: NEXT-4243 | auth_basic entry blocks backend access

This ticket is not intended for implementation. Therefore it was closed. Reasons that lead to such a decision can include the complexity or the scope of the ticket, as well as possible sources of error caused by the changes.[...]The short-term solution here is not to create the authentication through the hosting configuration, but to create it via htaccess / htpasswd and then not subject requests to the URL "/ api" to the authentication in the htaccess

关于.htaccess - 如何通过htaccess保护店铺?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66515031/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com