Apache 在 mod_rewrite 规则之前处理身份验证指令

发布于 2024-09-24 06:52:18 字数 266 浏览 3 评论 0原文

我使用 mod_rewrite 将人们从一个域重定向到另一个域(同时保留 URL 的其余部分)。两个域都指向相同的代码库。

其中一个目录的身份验证由本地 .htaccess 文件控制。

这些身份验证指令在处理 mod_rewrite 规则之前得到处理。因此,客户端会被要求输入密码两次。

我尝试将 mod_rewrite 规则放入 .htaccess 文件中,位于身份验证相关指令之上,但它以一种奇怪的方式失败。

防止这种双重身份验证的最简单方法是什么?

I'm using mod_rewrite to redirect people from one domain to another (whilst preserving the rest of the URL). Both domains point at the same codebase.

One of the directories has authentication controlled by a local .htaccess file.

These authentication directives get processed before the mod_rewrite rule are processed. Therefore the client gets asked for a password twice.

I've tried putting mod_rewrite rules into the .htaccess file, above the authentication related directives, but it fails in a strange way.

What's the easiest way to prevent this double authentication?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

树深时见影 2024-10-01 06:52:18

将您的身份验证指令放入 阻止 您希望对用户进行身份验证的主机。

Put your authentication directives into the <VirtualHost> block of the host you want the users to be authenticated.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文