gpt4 book ai didi

.htaccess - 我需要在主域而不是子域上强制使用 ssl

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

位于 www.mydomain.com 的主站点设置为使用 SSL 证书的安全站点。

我需要创建一个不安全的子域 ( http://open.mydomain.com )。

我在 InMotionHosting.com 托管。我在 cPanel 中创建了子域并将其指向 public_html/open 的文件夹(主站点位于 public_html/mainsite)但是当我尝试访问子域 URL 时,我在 Chrome 中遇到 SSL 错误,在 IE 中我得到重定向到 https://www.mydomain.com/open .

我该如何解决这个问题?

这是我的 .htaccess 文件:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

最佳答案

将您的规则更改为:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

关于.htaccess - 我需要在主域而不是子域上强制使用 ssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22703014/

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