Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache .htaccess重定向https://domain1.com 到https://domain2.com_Apache_.htaccess - Fatal编程技术网

Apache .htaccess重定向https://domain1.com 到https://domain2.com

Apache .htaccess重定向https://domain1.com 到https://domain2.com,apache,.htaccess,Apache,.htaccess,我们有domain.com和domain.com.au指向同一个网站,目前在.htaccess中有以下内容 RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://www.domain.com.au/$1 [R=301,L] RewriteCond %{HTTPS} on RewriteCond %{HTTP_HOST} !^www\.domain\.com\.au$ [NC] RewriteRule ^(

我们有domain.com和domain.com.au指向同一个网站,目前在.htaccess中有以下内容

RewriteEngine on

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.domain.com.au/$1 [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.domain\.com\.au$ [NC]  
RewriteRule ^(.*)$ https://www.domain.com.au/$1 [R=301,L]
这可以将站点的所有请求重定向到正确的安全url

唯一的问题是,当我们转到时,浏览器总是首先警告我们页面可能不安全-如果我们接受警告,那么页面将正确重定向到


在重定向正确的安全域之前,是否有某种方法可以防止此警告,或者我们是否应该以不同的方式写入.htaccess重定向?

防止此情况的唯一方法是:(1)为该域配置不同的虚拟主机,最好是在其自己的IP上(请参阅)。(2) 使用有效的SSL证书配置该主机(3)仍然执行重定向。感谢您提供的参考链接-现在就有意义了。