htaccess: 为某个重写地址加密, Password protection for a single .htaccess rewrite

.htaccess

SetEnvIfNoCase Request_URI "^/my-controller" SECURED

# enforce auth if SECURED
AuthType Basic
AuthName "Login"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
Order allow,deny
Allow from env=!SECURED
Satisfy any

设置好 .htpasswd 文件,打开  your-domain.com/my-controller 后,就会出现提示框,输入密码!

htaccess: 为某个重写地址加密, Password protection for a single .htaccess rewrite
htaccess: 为某个重写地址加密, Password protection for a single .htaccess rewrite

 

本文:htaccess: 为某个重写地址加密, Password protection for a single .htaccess rewrite