【发布时间】:2015-07-27 08:11:50
【问题描述】:
我正在尝试使用用户名和密码保护我的网站。
这是我在添加密码保护之前的 .htaccess
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
我在文件末尾添加了以下代码
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile .htpasswd
Require valid-user
所以我的 .htaccess 目前是 重写引擎开启
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile .htpasswd
Require valid-user
密码保护工作正常,但网站返回内部错误 500
为什么密码保护取消了重写引擎部分?请指教。
【问题讨论】:
-
我尝试在
之间添加密码保护,但它不起作用@SiZE