htaccess的允许访问特定用户 [英] htaccess allow access to specific user

查看:209
本文介绍了htaccess的允许访问特定用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图限制从一个特定的用户通过htaccess的访问到每个文件。 它甚至可能吗? 我无法弄清楚如何让每一个文件的访问只有当用户名不是具体的某一种,我使用HTTP登录用PHP(的$ _ SERVER REMOTE_USER)

I'm trying to limit the access to every file from a specific user through htaccess. It's even possible? I can't figure out how to allow every file access only if username is not a specific one, I use an HTTP login with PHP (REMOTE_USER of $_SERVER)

谢谢,对不起我的英文不好:)

Thanks and sorry for my bad english :)

推荐答案

您需要创建一个要允许与htpasswd的工具用户数据库/特定用户。从那里,在目录中的htaccess文件要限制,使用方法:

You'll need to create a user database/specific user you want to allow with the htpasswd utility. From there, in your htaccess file in the directory you want to limit, use:

AuthUserFile /path/to/.htpasswd
AuthName "Authorization Form Title"
AuthType Basic

#Allow any valid user
require valid-user

#Allow only one user with specified username
require user username

更多信息可在网上大量的引用中找到,这是第一次那上前之一: HTTP ://www.apacheweek.com/features/userauth

这篇关于htaccess的允许访问特定用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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