Apache .htaccess http到带有文件的https

Apache .htaccess http到带有文件的https,apache,.htaccess,mod-rewrite,redirect,https,Apache,.htaccess,Mod Rewrite,Redirect,Https,我正在尝试编写一个从http重定向到https的程序,并删除www。它已经删除了。我的问题是,如果你写:应该更改为,但不起作用,在.com之后没有检测到任何东西。有人帮我吗 RewriteEngine On RewriteCond% {HTTPS} off RewriteCond% {HTTP_HOST} ^ www.midominio.com RewriteRule ^ (. *) $ Https://midominio.com/$1 [R = 301, L] RewriteCond

我正在尝试编写一个从http重定向到https的程序,并删除www。它已经删除了。我的问题是,如果你写:应该更改为,但不起作用,在.com之后没有检测到任何东西。有人帮我吗

RewriteEngine On 
RewriteCond% {HTTPS} off 
RewriteCond% {HTTP_HOST} ^ www.midominio.com 
RewriteRule ^ (. *) $ Https://midominio.com/$1 [R = 301, L] 

RewriteCond% {HTTPS}! = On 
RewriteRule ^ / (. *) Https:% {SERVER_NAME} // / $ 1 [R = 301, L]

我想这个问题在这里之前已经得到了回答: 这里呢


谢谢,但不起作用,在其他主题中不存在RewriteCond%{HTTPS}上的答案重写引擎关闭RewriteCond%{HTTP_HOST}^www.midominio.com RewriteRule^.*$[R=301,L]重写cond%{HTTPS}=在重写规则时^.*$https://%{SERVER_NAME}%{REQUEST_URI}[R,L]
RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]