簡體   English   中英

在Codeigniter中將http重定向到https

[英]Redirect http to https in Codeigniter

我在StackOverflow中搜索類似的問題,但我需要一些不同的東西!

我想重定向我的所有網站的流量為HTTPS和沒有www。 為什么? 我的免費SSL證書不適用於'www。' 部分。

如果我輸入:

www.andremlsantos.com/somepage
http://www.andremlsantos.com/somepage
http://andremlsantos.com/somepage
https://andremlsantos.com/somepage

我想重定向到:

https://andremlsantos.com/somepage

我的.htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|css|js|images|subdomain|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Options -Indexes

<Files 403.shtml>
order allow,deny
allow from all
</Files>

如果免費證書是Let's Encrypt,您還可以將證書擴展到www子域。 但從SEO的角度來看,最好將流量集中到其中一個。 對於想要的重定向,我認為Gumbo的答案可能會有所幫助。 有關更實用的.htaccess段, 請查看此頁面

暫無
暫無

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

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