我将文件重写为.htaccess中的目录:
RewriteRule ^folder1/(\/|)$ index.php?a=folder1 [NC,QSA]
如何仅对此“folder1”进行密码保护?因此,当用户访问mysite.com/folder1/时,他们会被要求输入用户名&密码来访问它。
答案 0 :(得分:0)
你可以像这样使用.htaccess:
SetEnvIfNoCase Request_URI ^/folder1(/.*)?$ SECURED
AuthType Basic
AuthName "Password Protected Folder1"
AuthUserFile /full/path/to/.htpasswd
Require valid-user
Satisfy any
Order Allow,Deny
Allow from all
Deny from env=SECURED
RewriteEngine On
RewriteRule ^folder1/(/|)$ index.php?a=folder1 [NC,QSA,L]