htaccess doesn't work - always wrong password

前端 未结 9 2350
盖世英雄少女心
盖世英雄少女心 2020-12-15 04:04

I am trying to password protect a directory, and have two files in the directory which should password protected it:

  • .htaccess
  • .htpasswd
<
9条回答
  •  心在旅途
    2020-12-15 04:40

    I had a similar issue using MAMP and it was because i was creating .htpasswd by hand. Solution was to use htpasswd command in terminal:

    htpasswd -bc .htpasswd someuser somepass
    

    this created the .htpasswd file which worked fine with my .htaccess file which looked like so:

    AuthType Basic
    AuthName "This site is in alpha and requires a password."
    AuthUserFile "/Applications/MAMP/htdocs/mywebsite/.htpasswd"
    require valid-user
    

提交回复
热议问题