使用 .htaccess 拒绝访问文件夹和文件遇到授权用户时解锁文件夹

发布于 2024-09-24 14:32:29 字数 143 浏览 0 评论 0原文

我有一个 CMS 保存在我网站的单独文件夹中,暂时将其命名为 public_html\cms。我希望该文件夹最初使用 .htaccess 锁定,稍后当主持人到来时,他必须能够登录并获得对文件夹 CMS 的访问权限。

如何构建这个?

I have a CMS kept at seperately folder in my Website, lets name it public_html\cms for now. I want this folder initially locked using .htaccess and later on when a moderator comes, he must be able to login and gain access to the folder CMS.

How do build this?

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

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

发布评论

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

评论(1

倾听心声的旋律 2024-10-01 14:32:29

在这种情况下,您将需要使用密码保护目录选项。很好的教程之一是 Corz。请查看整个页面和搜索受密码保护的目录..部分。在这里您会找到您的要求。另一个不错的教程是这个

您需要为该特定目录设置授权密码,管理员也必须知道该密码。因此,现在,每当管理员想要进入该文件夹时,他都需要输入您最初设置的秘密密码。

每当您需要更改密码时,您都需要在“.htpasswd”文件中手动更改它,或者您需要使用 PHP 的文件写入内置函数覆盖该文件。

希望有帮助。

You will need to use the option of Password protected directories, in this case. One of the nice tutorials is of Corz. Please check out this whole page & search for the section of Password protected directories... Here you will find your requirement. Another nice tutorial is this one.

You will need to set up a Authorization password for that particular directory, which must also be made known to Administrator. So now, whenever the Administrator will want to go into that folder, he will need to type in that secret Password, which you had initially set it up.

Whenever you will need to change the password, you will need to either change it manually in the ".htpasswd" file, or you will need to overwrite this file using PHP's file writing built-in functions.

Hope it helps.

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