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

时间:2015-01-23 15:45:37

标签: apache .htaccess mod-rewrite redirect ssl

我有两个域,DomainA和DomainB - 它们是分开托管的。 DomainB使用SSL是安全的,而DomainA则不是。我希望如果用户输入http://DomainA.com/donation,他会看到安全https://DomainB.com的内容而没有任何重定向。我想也许重定向规则可以解决问题(我搜索了Google和Stackoverflow,没有运气)

我在DomainA .htaccess中写了以下RewriteRule

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

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

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

1 个答案:

答案 0 :(得分:0)

还提供SSL以防止这类事情发生。所以我希望这是不可能的。

您可以在http://DomainA.com.htaccess中使用它:

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