如何使只有一页需要.htaccess auth?
这是我的问题。我有一个页面 www.example.com,我不想公开访问该页面,因此我希望将其置于某种登录后面。
问题是我还需要公开访问 www.example.com/api 。
您对如何实现这一目标有什么想法吗?
此致, 姆拉乔
Here is my problem. I have one page www.example.com which I don't want to be publicly accessible, so I want to have it behind some kind login.
The problem is that I also have www.example.com/api which I need to be publicly accessible.
Do you have any ideas how to achieve this?
Best regards,
Mladjo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.htaccess(或
指令)适用于您放入的目录 (.htaccess) 或您指定的目录(
指令),以及该目录下的所有子目录。如果您希望控制访问某个特定文件,请将其放在比您的 Web 根目录更深一层的自己的目录中,并将访问限制仅应用于该路径及其子目录。.htaccess (or the
<DIRECTORY>
directive) applies to the directory you put it in (.htaccess) or the directory you specify (<DIRECTORY>
directive), and all sub-directories below that one. If you have a specific file that you wish to control access on, put it in its own directory one level deeper than your web-root directory, and apply your access restriction to that path and its subdirs only.