使用的.htaccess密码保护整个网站不是登陆页面其他 [英] Using .htaccess to password protect entire site other than landing page

查看:89
本文介绍了使用的.htaccess密码保护整个网站不是登陆页面其他的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能使用的.htaccess来保护整个网站,比的index.html登陆页面等?

Is it possible to use .htaccess to protect an entire site, other than the index.html landing page?

事物的密码保护一面是容易的。

The password protection side of things is easy.

一直在寻找年龄,我已经拿出最接近的是添加以下算账:

Have been searching for ages, and the closest I've come up with is add the following afterwards:

<Files index.html>
satisfy any
</Files>

虽然这个工作,如果有人访问 http://www.example.com/index.html,它的的工作,如果他们访问 http://www.example.com ,即使我想补充的DirectoryIndex index.html的。删除的东西密码保护侧带他们到index.html的,但它也要求输入密码时,我只需输入域名。

While this works if someone visits http://www.example.com/index.html, it doesn't work if they visit http://www.example.com, even if I add DirectoryIndex index.html. Removing the password protection side of things takes them to index.html, but with it in it asks for a password when I just enter the domain name.

是否尝试过的东西喜欢用重写规则重写^ / $以index.html的或含有的登录页面的子目录 - 但这些不工作,因为它似乎验证任何重写之前完成

Have tried things like using rewrite rules to rewrite ^/$ to index.html or a subdirectory containing the landing page - but those don't work since it seems the authentication is done before any rewrites.

这甚至可能吗?

推荐答案

好像这里没有人知道答案,但我设法从别人的解决方案:

Seems nobody here knew the answer, but I managed to get a solution from someone else:

<Files .>
satisfy any
</Files>

这篇关于使用的.htaccess密码保护整个网站不是登陆页面其他的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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