My Question
Why .htaccess and .htpasswd does not accept my log-in info?
My sources to learn what should I do
- http://www.addedbytes.com/blog/code/password-protect-a-directory-with-htaccess/
- http://www.elated.com/articles/password-protecting-your-pages-with-htaccess/
What I Did?
I took my full path info from phpinfo()
full path to my root: /home/userid/public_html
I put my .htpasswd into root folder (public_html) so full path to my .htpasswd: /home/userid/public_html/.htpasswd
my admin folder name that I want to protect via password: adminfolder
I put my adminfolder
into root folder (public_html)
Folder Structure
public_html
---- .htaccess {permission: -rw-r--r--}
---- .htpasswd {permission: -rw-r--r--}
---- adminfolder {permission: drwxr-xr-x}
---- ---- .htaccess {permission: -rw-r--r--}
---- ---- other secret files {permission: -rw-r--r--}
.htaccess code (the one in adminfolder)
AuthUserFile /home/userid/public_html/.htpasswd
AuthName "Log In"
AuthType Basic
Require valid-user
.htpasswd code
note: This the encrypted version of my raw password.
admin:zv.sqVSz3W1nk
.htaccess code (the one just in public_html)
RewriteEngine On
RewriteBase /
#always use www - redirect non-www to www permanently
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# hotlink protection
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.p.ht [NC]
RewriteRule \.(jpg|jpeg|png|gif|css|js)$ - [NC,F,L]
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# File caching is another famous approach in optimizing website loading time
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
# disable directory browsing
Options All -Indexes
# secure htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
# secure spesific files
<Files a_secret_file.php>
order allow,deny
deny from all
</Files>
#SEO friendly linking
...
...
I checked
- my fullpath info
- username - raw and encrypted passwords
- codings
- all my files are prepared in notepad++ & encoded UTF-8 without BOM
Lastly
I tried at chrome. I entered username + non-encrypted raw password. Chrome asked me to log-in again.
then I cleared all cache of IE. Again I entered username + non-encrypted password. IE also asked me to log-in again.
Can you please correct me? thanks, BR
test:clKAOxsMt8tC6
(test:test),test:$apr1$EACwDAeN$mnZR16XpfBwIfyPfdQtaU1
(test:test) – Flouncing