2016-06-14 76 views
1

我们已经具有服务器2个域重定向HTTP到HTTPS为多个域

1)exmaple.co

2)exmaple.com.au

如果用户点击第一结构域“example.co “

http://www.exmaple.cohttp://exmaple.co那么就应该重定向到

https://exmaple.co

如果用户点击第二个域 “example.com.au”

http://www.exmaple.com.au OR http://exmaple.com.au那么它应该是 重定向到

https://exmaple.com.au

我们有购买SSL。

我们有使用框架Codeigniter在htaccess中设置编码。

RewriteCond %{HTTP_HOST} ^exmaple.co [NC] 

RewriteRule ^(.*)$ http://exmaple.co/$1 [L,R=301] 

RewriteCond %{HTTP_HOST} ^exmaple.com.au [NC] 

RewriteRule ^(.*)$ http://www.exmaple.com.au/$1 [L,R=301] 

如果我使用上面的代码,那么它会进行重定向循环。

回答

0

您正在获得无限的重定向循环,因为您并未阻止重定向发生。

要达到什么样的你正在尝试做的:

RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} ^(www\.)?example\.co$ 
RewriteRule ^(.*)$ https://example.co/$1 [L] 

RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com\.au$ 
RewriteRule ^(.*)$ https://example.com.au/$1 [L]