dim*_*vic 7 authentication .htaccess htpasswd apache-2.2
我在 apache 配置中使用了这样的代码来保护带有密码的位置
<Location ~ "/admin.*">
AuthType Basic
AuthName "Protected Area"
AuthUserFile /home/user/public_html/.htpasswd
Require valid-user
</Location>
Run Code Online (Sandbox Code Playgroud)
有没有办法使用 htaccess 文件做同样的事情?
我想保护的位置在文件系统上并不真正存在,由于 mod_rewrite,它的位置可用
是的,可以这样做,将 htaccess 放入您想要控制访问的文件中。输入与配置文件中相同的文本。确保您的conf 文件将读取.htaccess。