如何将需要使用的.htaccess的所有文件,密码除了一个? [英] How would I require a password for all files except one using .htaccess?

查看:222
本文介绍了如何将需要使用的.htaccess的所有文件,密码除了一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新的网站我工作的客户端要保守秘密,但在同一时间,我想在建页,把一个与它的一些信息。我想拥有一切,除了index.html的需要用户名/密码 - index.html的将是提供给大家。

我有以下的,但我不知道我需要添加:

  AuthName指令限制区
与AuthType基本
的AuthUserFile /path/to/file/.htpasswd
目录AuthGroupFile的/ dev / null的
需要有效的用户
 

有太多的文件,并可能新文件说:这组文件需要用户名/密码。

我认为这是与类似于:

 <文件的index.html>
为了否认,允许
允许所有
< /文件>
 

但我不完全知道如何。

解决方案

  AuthName指令限制区
与AuthType基本
的AuthUserFile /path/to/file/.htpasswd
目录AuthGroupFile的/ dev / null的

<文件*>
需要有效的用户
< /文件>

<文件的index.html>
所有允许
满足任何
< /文件>
 

I have a new website I'm working on that the client wants to keep a secret, but at the same time, I want to put an under construction page with some info on it. I would like to have everything except index.html require a user/password--index.html would be available to everyone.

I have the following, but I'm not sure what I need to add:

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/file/.htpasswd
AuthGroupFile /dev/null
require valid-user

There are too many files and possibly new files to say "for this set of files require a user/password".

I think it has something to do with something similar to:

<Files index.html>
order deny,allow
allow from all
</Files>

But I'm not exactly sure how.

解决方案

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/file/.htpasswd
AuthGroupFile /dev/null

<Files "*">
Require valid-user
</Files>

<Files "index.html">
Allow from all 
Satisfy any
</Files>

这篇关于如何将需要使用的.htaccess的所有文件,密码除了一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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