.htaccess - 将 htaccess 和 htapassrd 添加到 heroku 站点

标签 .htaccess heroku .htpasswd

我正在尝试使用应用程序根目录中的 .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.

https://gist.github.com/bbrewer97202/3316425

关于.htaccess - 将 htaccess 和 htapassrd 添加到 heroku 站点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42224739/

相关文章:

.htaccess - 如何在没有重定向循环的情况下使用 htaccess 转发到 https

javascript - 使用 .htpasswd 锁定 .user.js 文件

linux - htpasswd : wrong credentials created

.htaccess mod_rewrite 豁免

php - 为什么 Apache RewriteRule 以相同的方式处理 '&' 和 '?'

php - 如何根据查询字符串中的匹配使用 SetEnvIf?

php - Heroku PHP 和 Apache dyno 崩溃并出现错误 H10

ruby-on-rails - 如何查看我的 heroku 数据库的记录?

ruby-on-rails - Heroku - 如何从数据库中提取数据到本地数据库?

.htaccess - .htpasswd/.htaccess 出现 500 内部服务器错误