簡體   English   中英

htaccess重定向到https:// www url

[英]htaccess redirect to https://www url

我必須使用htaccess在https://www.example.com上重定向我的網站。

我已經使用了許多解決方案,但是當我從https刪除“ s”時,我的網站在http上運行,而當我僅運行www.example.com時,它將在http上運行,僅適用於“ example.com”。

我提到的解決方案如下

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]  
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

有沒有人有一個神奇的解決方案。

采用:

# http(s)://domain  ->  https://www.domain
RewriteCond %{HTTP_HOST} !^www\. [OR,NC]
RewriteCond %{HTTPS} off 
RewriteRule ^ https://www.domain.com%{REQUEST_URI} [NE,R=301,L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM