当前位置: 动力学知识库 > 问答 > 编程问答 >

How to make that only one page requires .htaccess auth?

问题描述:

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

网友答案:

.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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: