gpt4 book ai didi

php - 在 Codeigniter 中将 http 重定向到 https

转载 作者:搜寻专家 更新时间:2023-10-31 21:22:07 27 4
gpt4 key购买 nike

我在 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's答案可能会有所帮助。更多有用的 .htaccess 片段 check this page .

关于php - 在 Codeigniter 中将 http 重定向到 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45001465/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com