的.htaccess需要有效的用户[从本地主机除外] [英] .htaccess Require valid-user [except from localhost]

查看:511
本文介绍了的.htaccess需要有效的用户[从本地主机除外]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想密码保护目录,除了从来自本地主机的请求。 我的.htaccess看起来是这样的:

I'm trying to password protect a directory except from requests that come from localhost. My .htaccess looks like this:

AuthName "Login"
AuthType Basic
AuthUserFile /PATH/.htpasswd
Require valid-user
Allow from 127.0.0.1
Allow from ::1
Satisfy Any


RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

ErrorDocument 404 /index.php

如果我删除允许和手托报表目录中获取正确的保护。当我添加允许(一个或两个),并满足任何它生成一个500错误。日志说:

If I remove Allow and Satisfy statements the directory gets correctly protected. When I add the Allow (one or both) and Satisfy Any it generates a 500 error. The log says:

/PATH/.htaccess: allow not allowed here

任何线索?

推荐答案

如果您可以访问服务器的conf文件,请检查:的AllowOverride 见什么是允许指令

If you you have access to server conf files, check for: AllowOverride See for what directives are allowed.

AllowOverride All

将允许所有指令。

will allow all directives.

有关详情,请访问: AllowOverride指令 Apache的文档

For more visit: AllowOverride Directive Apache Docs

这篇关于的.htaccess需要有效的用户[从本地主机除外]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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