如何从.htaccess密码保护允许网址类型?

时间:2017-10-12 10:41:30

标签: php .htaccess

我的网站有.htaccess密码保护。现在我想允许网站的一些URL。

https://www.exampale.com受密码保护。 但我不想要https://www.exampale.com/test/page/ {variable}

的任何密码弹出式展示

这可以在.htaccess文件中使用吗?

需要反向Password protect a specific URL

1 个答案:

答案 0 :(得分:2)

您可以将其与mod_setenv指令一起用作:

# set variable NO_PASS if URI starts with /test/page/
SetEnvIfNoCase Request_URI "^/test/page/" NO_PASS

# Allow NO_PASS but ask for password otherwise
AuthType Basic
AuthName "My Protected Area"
AuthUserFile /Full/Path/To/passwords
Require valid-user
Satisfy    any
Order      deny,allow
Deny from  all
Allow from env=NO_PASS
相关问题