我在Windows 10上運行MAMP 3.2.2,Apache在端口8888上運行。我試圖密碼保護目錄C:\ MAMP \ htdocs \ admin \通過在其中放置一個.htaccess和一個.htpasswd文件。MAMP Htaccess密碼保護:重複「需要驗證」對話框
.htacess是:
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile C:\MAMP\htdocs\admin\.htpasswd
Require valid-user
htpasswd的(用戶=測試;密碼=試驗)是:
test:dGRkPurkuWmW2
我檢查MAMP的Apache的httpd.conf和它說,在線路202:
<Directory />
Options FollowSymLinks ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
而且,在線路220:
<Directory "C:\MAMP\htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
嘗試導航到「http://localhost:8888/admin/index.php」時,出現「需要驗證」對話框,並說「http://localhost:8888正在請求您的用戶名和密碼」。但是,輸入用戶名和密碼後,對話框將不斷重新出現,而不是授予我訪問權限。
我錯過了什麼?
預先感謝您!
的問題是,我是用PHP「$ encryptedPassword =隱窩($ typedPassword,BASE64_ENCODE($ typedPassword ));」以創建編碼密碼,因爲我不想依賴於使用其他網站的密碼生成器。有沒有人知道加密密碼的正確方法? –