开发者

Using .htaccess to password protect entire site other than landing page

开发者 https://www.devze.com 2023-02-24 22:29 出处:网络
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.

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>

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.

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.

Is this even possible?


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

<Files .>
satisfy any
</Files>
0

精彩评论

暂无评论...
验证码 换一张
取 消