简体   繁体   中英

.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,

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.

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. I don't think "Localhost" can be a path. Change that path to correct path and it will start working.

AuthUserFile <correct path to htpassword>/.htpasswd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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