2016-07-27 49 views
1
AuthUserFile /localhost/htaccess_pwd/main/.htpasswd 
AuthType Basic 
AuthName "You need to be authorized!!" 
Require valid-user 

<Files "page1.php"> 
Require valid-user 
</Files> 

導致500內部服務器錯誤在上面的代碼中,我要保護一個文件,即page1.php中甚至同時擊中的URL它把用戶名和密碼之後問我的用戶名和password.But說,的.htaccess在localhost

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

請幫助解決它。

+1

一般的規則:如果你得到一個500,你先去看看服務器日誌,以獲取有關500 –

+0

細節是這條道路是否正確? /localhost/htaccess_pwd/main/.htpasswd – error2007s

+0

@MarcB它引發以下錯誤: [Wed Jul 27 21:39:45.232063 2016] [authn_file:error] [pid 3460:tid 1588](OS 3)系統無法找到指定的路徑。 :[client 127.0.0.1:60661] AH01620:無法打開密碼文件:C:/localhost/htaccess_pwd/main/.htpasswd –

回答

0

你在htaccess中的問題是有關路徑見下文。我不認爲「本地主機」可以成爲一條路。將該路徑更改爲正確的路徑,它將開始工作。

AuthUserFile <correct path to htpassword>/.htpasswd