.htaccess .htpasswd 訪問密碼設置

  1. .htaccess

    #絕對位置
    AuthUserFile D:/phpStudy/WWW/test_htaccess/.htpasswd
    AuthType Basic
    AuthName "restricted"
    Order Deny,Allow
    Deny from all
    Require valid-user
    Satisfy any
    
  2. .htpasswd
    fly:apr1 8o5QSoJ.$I8fFOb12VkhL5V3mlZtgm.

  3. index.php

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>測試文件</title>
    </head>
    <body>
    <div align="center">
        恭喜你,你訪問到本目錄下的文件了!
    </div>
    </body>
    </html>
    

    測試地址:/test_htaccess/(用戶名:ccp330;密碼:1234567)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章