And*_*ier 6 php apache .htaccess .htpasswd
为什么.htaccess和.htpasswd不接受我的登录信息?
我从中获取了完整的路径信息 phpinfo()
我的根的完整路径: /home/userid/public_html
我把我的.htpasswd放到根文件夹(public_html)中,这是我的.htpasswd的完整路径: /home/userid/public_html/.htpasswd
我想通过密码保护的管理员文件夹名称: adminfolder
我把我adminfolder放到根文件夹(public_html)
文件夹结构
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--}
Run Code Online (Sandbox Code Playgroud)
AuthUserFile /home/userid/public_html/.htpasswd
AuthName "Log In"
AuthType Basic
Require valid-user
Run Code Online (Sandbox Code Playgroud)
注意:这是我的原始密码的加密版本.
admin:zv.sqVSz3W1nk
Run Code Online (Sandbox Code Playgroud)
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
...
...
Run Code Online (Sandbox Code Playgroud)
我试过镀铬.我输入了用户名+非加密的原始密码.Chrome让我再次登录.
然后我清除了IE的所有缓存.我再次输入用户名+非加密密码.IE还要求我再次登录.
你能纠正我吗?谢谢,BR
小智 6
这个问题是因为您的服务器可能使用不同的算法来加密/解密密码,您可以从不同的算法中测试不同的密码组合以找出正确的密码.
请参阅此网站:http://aspirine.org/htpasswd_en.html
它使用JavaScript生成密码,出于安全原因,您可以保存页面并在本地运行它.