htaccess从基本身份验证中排除多个网址 [英] htaccess exclude multiple url from Basic Auth
本文介绍了htaccess从基本身份验证中排除多个网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在测试阶段保护我的应用。
Hi i need to protect my app during the testing phase.
我阅读了此发布关于从基本身份验证中排除一个URL
I read this post about excluding one url from Basic Auth
但我想排除2个网址:
/ api / *
/api/*
/ oauth / v2 / token
/oauth/v2/token
因此,除了这两个URL之外,整个应用程序都将受到保护,这些URL将是公共的。否则我将无法访问我的api路由。
So the entire app will be protected except for those two urls, that will be public. Otherwise i can't access my api routes.
我现在的.htaccess是:
My .htaccess for now is :
# Protect the app with password
AuthUserFile /home/master/public_html/web/.htpasswd
AuthName "Protected"
AuthType Basic
Require valid-user
所以我想我应该在:
SetEnvIf Request_URI ^/api/ noauth=1
我怎么会喜欢OR条件?
How can i have like a OR condition?
推荐答案
尝试:
SetEnvIf Request_URI ^/(api/|oauth/V2/token) noauth=1
您可以排除uri,只需使用栏 |
You can exclude uris, just seperate them using a bar |
这篇关于htaccess从基本身份验证中排除多个网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文