受密码保护的网页内容——基本问题

发布于 2024-10-10 10:19:13 字数 247 浏览 0 评论 0原文

我希望在我的网站上创建一个需要用户登录的密码保护部分,我想知道什么方法可以提供最简单的解决方案。在大多数情况下,该站点将非常简单和静态 - 即对数据库/后端没有真正的要求 - 受保护的内容包含在单个目录中,我已经通过 htaccess 在我的服务器上配置了该目录。我想我最终想知道是否可以使用某种脚本来通过表单访问此受保护的目录,从而绕过配置 mySQL/PHP 解决方案的需要?此外,这种受保护的内容并不完全是超敏感的,但仍然是私密的。

非常感谢这里的任何指导。

I'm looking to create a password-protected section of my website that requires user login, and I'm wondering what approach would provide the simplest solution. For the most part, the site will be very simple and static-- i.e. no real requirement for a database/backend-- with the protected content contained in a single directory, which I've already configured on my server via htaccess. I guess I'm wondering ultimately if it's possible to use a script of some sort that will enable access to this protected directory via a form and thereby bypass the need for configuring a mySQL/PHP solution? Furthermore, this protected content is not exactly hyper-sensitive, but private nonetheless.

Thanks much for any direction here.

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

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

发布评论

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

评论(2

∞觅青森が 2024-10-17 10:19:13

在您的情况下,我将设置一个普通(公共)HTML 页面,作为受保护内容的“入口”页面。它将描述它是什么以及如何登录(或其他),并提供一个普通的登录链接。该链接将转到您受密码保护的目录,这将弹出一个浏览器弹出框,要求用户名和密码。

这个方案大约包含了登录表单 99% 的功能,只包含了大约 1% 的麻烦。

In your situation, I would set up an ordinary (public) HTML page that is the "entry" page to your protected content. It would describe what it is and how to log in (or whatever), and provide an ordinary link to log in. That link would go to the directory you've password protected, which would bring up a browser popup box requesting username and password.

This scheme is about 99% of the functionality of a login form, with about 1% of the hassle.

赤濁 2024-10-17 10:19:13

您可以编写一些 PHP 脚本来委托 Web 服务器在自定义身份验证后转发文件。

您可能需要为 Apache 安装 mod_xsendfile 并使用 X-Sendfile
对于Nginx,只需使用X-Accel-Redirect

我认为它并不常见,但由于某些原因,它可能很有用。

https://www.nginx.com/resources/wiki/开始/主题/示例/x-accel/
https://tn123.org/mod_xsendfile/


这是太老的问题了!我没有注意到日期,因为我还是这个网站的新手。抱歉打扰了。

You could write some PHP script for delegating the web server to forward files after your customised authentication.

You may need to install mod_xsendfile for Apache and use X-Sendfile.
For Nginx, just use X-Accel-Redirect.

I think it is not common, but for some reasons, it can be useful.

https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/
https://tn123.org/mod_xsendfile/


It's too old question! I didn't noticed the date since I'm still new to this site. Sorry for bothering.

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