简体   繁体   English

.htaccess在localhost上导致500内部服务器错误

[英].htaccess causing 500 internal server error on localhost

AuthUserFile /localhost/htaccess_pwd/main/.htpasswd
AuthType Basic
AuthName "You need to be authorized!!"
Require valid-user

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

In the above code I want to protect a file ie page1.php and even while hitting the url it asks me for username and password.But after putting username and password it says, 在上面的代码中我想保护一个文件,即page1.php,甚至在点击url时它会询问我的用户名和密码。但是在输入用户名和密码后,它说,

The server encountered an internal error or misconfiguration and was unable to complete your request. 服务器遇到内部错误或配置错误,无法完成您的请求。

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error. 请通过admin@example.com与服务器管理员联系,告知他们此错误发生的时间以及您在此错误发生之前执行的操作。

More information about this error may be available in the server error log. 服务器错误日志中可能提供了有关此错误的更多信息。

Please help to fix it. 请帮忙解决它。

The issue in you htaccess is regarding the path see below. 你htaccess中的问题是关于路径,见下文。 I don't think "Localhost" can be a path. 我不认为“Localhost”可以成为一条路径。 Change that path to correct path and it will start working. 将该路径更改为正确的路径,它将开始工作。

AuthUserFile <correct path to htpassword>/.htpasswd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM