htaccess 与受密码保护的目录

发布于 2024-08-25 05:56:06 字数 373 浏览 3 评论 0原文

我必须向我正在处理的站点添加密码保护区(使用 .htpasswd 文件)。问题是它所指向的整个目录结构并不存在,而是通过 mod_rewrite 创建的。

它仍然有效吗?或者该目录实际上必须存在于服务器上吗?

澄清: 虽然我可能需要密码保护目录: http://sitename/category/protected/

mod_rewrite 将其转换为: index.php?category=category&directory=protected

因此实际目录不存在。还可以保护吗?

I have to add a password protected zone to a site I am working on (using the .htpasswd file). The thing is the whole directory structure it's being pointed at doesn't exist and is created through mod_rewrite.

Will it still work, or does the directory actually have to physically exist on the server?

Clarification:
While I may need to password protect the directory:
http://sitename/category/protected/

mod_rewrite translates this to:
index.php?category=category&directory=protected

So the actual directory does not exist. Is it still protectable?

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

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

发布评论

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

评论(2

破晓 2024-09-01 05:56:07

您可以将访问规则添加到目录或位置标记中的 apache 配置文件(httpd.conf 或类似文件),而不是将其添加到 .htaccess 文件中。

You can add the access rules to the apache config file (httpd.conf or similar) in a Directory or Location tag instead of adding it in the .htaccess file.

青瓷清茶倾城歌 2024-09-01 05:56:07

您的重写规则最终将指向系统上目录中的某些文件(除非它们将用户重定向到某个外部位置)。身份验证设置应位于将访问的基础目录上。

Your rewrite rules will ultimately point to some files in a directory on your system (unless they redirect users to some external location). The authentication setup should be on the underlying directory that will be accessed.

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