gpt4 book ai didi

html - https 和 http 重定向

转载 作者:太空宇宙 更新时间:2023-11-03 13:15:59 27 4
gpt4 key购买 nike

我已经购买了域名、专用 IP 和 ssl 证书。我想这样做 -

我想重定向所有这些 url -

http://webs.agency/
http://www.webs.agency/
https://webs.agency/

https://www.webs.agency/

对于所有内部页面都应该做同样的事情 -

http://webs.agency/web-design.html
http://www.webs.agency/web-design.html
https://webs.agency/web-design.html

https://www.webs.agency/web-design.html

如何通过 .htaccess 完成。

我已经联系了托管公司,他们说他们不能在这方面帮助我。

最佳答案

所以你想对所有内容强制使用 WWW 和 HTTPS。

RewriteEngine On

#Force WWW on everything
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

#Force HTTPS on everything
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

这应该为您留下 https://www.webs.agency/https://www.webs.agency/web-design.html

关于html - https 和 http 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38077991/

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