强制https与Apache之前.htpasswd

我有这个在我的.htaccess文件

RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://www.myweb.com/phpmyadmin$1 [R,L] AuthUserFile /var/www/myweb/.htpasswd AuthGroupFile /dev/null AuthName "Sovereign Databases" AuthType Basic <Limit GET> require valid-user </Limit> 

但每次我去http://www.myweb.com/phpmyadmin,.htpasswd提示我的凭据之前,我redirect到https://www.myweb.com/phpmyadmin 。 input我的用户名和密码后,我被redirect到https://www.myweb.com/phpmyadmin 。 问题是我不希望任何人通过http提交未encryption的用户名和密码。

如何强制用户通过https版本login,即使他们在http版本中input?

Auth语句移动到<VirtualHost *:443>块。

(其他人可能会有一个更优雅,更好的答案)。