开发者

htaccess protect all website but some paths

开发者 https://www.devze.com 2023-02-13 08:11 出处:网络
I need to protect all http://domain.com with AuthType Basic, but leave http://domain.com/foo/bar (http://domain.com/foo/bar is a rewrite url, not a folder)

I need to protect all http://domain.com with AuthType Basic, but leave http://domain.com/foo/bar (http://domain.com/foo/bar is a rewrite url, not a folder)

I read about location tag but it not work in htaccess file :开发者_JS百科(.


RewriteCond %{REQUEST_URI} !^(foo/bar)
-- protect howsoever you want --


I found the answer:

SetEnvIfNoCase REQUEST_URI "/foo/bar" ExcludePath

AuthName "SiteName Administration"
AuthUserFile /.htpasswd
AuthType basic
Require valid-user

Order deny,allow
Deny from all
Allow from env=ExcludePath
Satisfy Any
0

精彩评论

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