我以为我做对了,但是当我在浏览器中键入example.com时,它没有重定向,则显示出无服务器IP错误。
我现在拥有的代码是:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
RewriteCond %{http_host} ^www.example.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
欢呼
答案 0 :(得分:0)
尝试一下:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) https://www.example.com/$1 [R=301,L]