我怎样才能让我的网站显示为https://www


How can i get my website to display as https://www

此问题与其他问题无关,请完整阅读。我在网上找遍了答案。

我们希望我们的整个网站显示为https://www

基本上https://不会重定向到https://www

我以为我已经解决了这个问题…

RewriteCond %{HTTP_HOST} !^www'.

RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L]

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}$1

但是当我们这样做时,主页重定向工作正常但其他页面的url末尾重复两次例如/printing。htmlprinting。html

如何让所有内容显示https://www

使用这个(不带最后一个$1):

RewriteCond %{HTTP_HOST} !^www'.
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]