使用基本身份验证(htaccess的)限制访问特定的网址 [英] Using Basic Authentication (htaccess) to restrict access to a specific URL

查看:185
本文介绍了使用基本身份验证(htaccess的)限制访问特定的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要限制访问特定的网址,例如: http://mydomain.com/this/is/the/url 上通过Apache使用基本身份验证我的网络服务器。任何其他URL应该公开访问。我所看到的,您可以使用添加特定的规则文件:

I need to restrict access to a particular URL, e.g. http://mydomain.com/this/is/the/url on my webserver using Basic Authentication through Apache. Any other URL should be openly accessible. I have seen that you can add specific rules to files using:

<Files "mypage.html">
  Require valid-user
</Files>

我的问题是,所有的请求路由到使用mod-rewrite控制器,所以我不认为基于文件,我可以限制访问。任何想法将是最有帮助的!

My problem is that all requests are routed to controllers using mod-rewrite and so I don't think that I can restrict access based on the file. Any ideas would be most helpful!

推荐答案

您可以通过将一个单独的的.htaccess 在该目录中保护整个目录。本教程说明它比我更可以:

You can protect the entire directory by placing a separate .htaccess in that directory. This tutorial explains it better than I could:

http://www.addedbytes.com/lab /密码保护 - 一个目录与 - htaccess的/

这篇关于使用基本身份验证(htaccess的)限制访问特定的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆