无法强制重定向到https

时间:2017-12-19 09:24:05

标签: .htaccess ssl https

我的网站在online.net有问题。 我想强制http使用https,但我失败了。 在.htacess中,当我使用以下

时它没有做任何事情
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^my-website\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://my-website.com/$1 [R,L]

我尝试

时出现内部服务器错误
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]

感谢您的帮助!

0 个答案:

没有答案