Search code examples
apache.htaccess.htpasswd

.htpasswd 500 error with correct full path


I need to protect my HTML-page (admin.html) with password and I'm using .htpasswd + .htaccess files

As far as I understand, there is no need to write htmk containing flder in tag. But I've set full path to .htpasswd! So why do I get 500 error with this .htaccess - file?

<Files "admin.html"> AuthName "Username and password required" AuthUserFile D:\Program Files (x86)\xampp\htdocs\news_back\client\.htpasswd Require valid-user AuthType Basic </Files>

both files (admin.html and .htpasswd) are in "client" folder. (Yes, I've tried <Files "client/admin.html">)

Content of .htpasswd: admin:$apr1$7n2mqwOp$INTz7H7lnL8dZVXlxcIu31

My op. system is Windows 7, I run XAMPP(with Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.5.24) locally.


Solution

  • Just guessing here, I have very little experience in MS-Windows based systems. But these typical back slashes spring into the eye. Could it be that you have to escape them? Because on every sane system the back slash has a special meaning that might cause problems. Same with the space character, the colon (:) and the brackets ((,)).

    Have a try putting the file to a location with less risky naming. Just as a test. Does that work?