我有一个Yii 1.1的标准.htaccess,我添加了基于http的授权。
当我添encryption码保护时,重写条件RewriteCond %{REQUEST_FILENAME} !-f停止工作,现在静态文件请求通过index.php处理
但实际上密码保护也不起作用,我可以不input任何login数据,点击login,或者点击取消,网站就会显示出来。
这里可能会发生什么?
我尝试了每个选项来解决密码文件,使用完整的path,使用〜相对path,和当前目录相对path在这里的代码,但都没有工作。
我用一个在线工具创build了.htpasswd文件,我相信它是可以的,但如果格式不正确,是不是应该阻止访问而不是授予它? 我怎么得到一个密码,没有给出,然后让我走了吗?
的.htaccess:
AuthType Basic AuthName "Authorreach Staging" AuthUserFile .htpasswd Require valid-user # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # --- Lines relevant to this question end here (I think) --- # For security reasons, Option followsymlinks cannot be overridden. #Options +FollowSymLinks Options +SymLinksIfOwnerMatch RewriteEngine on <Files ~ "\.(jpg|jpeg|png|gif|pdf)$"> order deny,allow allow from all FileETag MTime Size </Files> # otherwise forward it to index.php RewriteRule . index.php