簡體   English   中英

將所有沒有http請求重定向到https + www(子域除外)

[英]Redirect all no http request to https+www except subdomains

在創建.htaccess文件以進行正確重定向時,我在這里遇到了一些問題。 除了子網域,我需要將所有請求重定向到帶有www的https。

這是方案:

http://example.com-> https://www.example.com
https://example.com-> https://www.example.com
http://www.example.com-> https://www.example.com
http://subdomain.example.com-> http://subdomain.example.com[unchanged]
or
http://subdomain.example.com-> https://www.example.com/sites/subdomain  

非常感謝您的幫助。

在文檔根目錄的htaccess文件中,將其添加到頂部:

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

暫無
暫無

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

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