我正在尝试使用应用程序根目录中的 .htaccess 和 .htpasswrd 文件临时使用密码保护我的 Heorku 应用程序。
我收到以下代码的“内部服务器错误”,但无法弄清楚哪里出了问题
.htaccess
AuthUserFile .htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user
.htpasswrd(MD5 加密)
rob:$apr1$MRsSwhFN$buG0YTSOezeY8YJ32LXnT1
最佳答案
看来你的道路已关闭。
As of July 2016, some subtle changes are necessary on heroku-php-apache2. Please note that the path to the .htpasswd file no longer contains the www directory and that the .htpasswd file should be in the webroot as well.
Create an .htaccess file in the webroot:
AuthUserFile /app/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user
Create a .htpasswd file, also in the webroot:
htpasswd -c .htpasswd [username]
Commit local changes. Deploy to Heroku.
关于.htaccess - 将 htaccess 和 htapassrd 添加到 heroku 站点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42224739/