在 HTTP 站点中显示 HTTPS 内容,使用 RewriteRule

Showing HTTPS content in HTTP site, using RewriteRule

我有两个域,DomainA 和 DomainB - 它们是分开托管的。 DomainB 使用 SSL 是安全的,而 DomainA 则不是。我希望如果用户在没有任何重定向的情况下输入 http://DomainA.com/donation he will see the content of the secured https://DomainB.com。我想也许重定向规则可以解决问题(我搜索了 Google 和 Whosebug,但没有成功)

我在 DomainA .htaccess 中写了下面的 RewriteRule

RewriteCond %{HTTP_HOST} ^DomainA.com/donation
RewriteRule ^(.*) https://DomainB.com/ [P]

我的问题是 - DomainB 的 SSL 仍然有效吗?假设用户将输入 DomainA.com/donation,他会看到什么?与往常一样使用证书的 DomainB 的安全内容?如果不是,则意味着保留 DomainB 证书的唯一方法是使用 [R=301] ?

重定向 DomainA 的整个页面

由于客户的要求,我无法实时查看。

还提供了 SSL 来防止这种情况发生。所以我希望这是不可能的。

您可以在您的 http://DomainA.com 根目录中使用它 .htaccess:

RewriteEngine on
RewriteRule ^donation/? https://DomainB.com/ [NC,R=301]