.htaccess - redirect to http to https for multiple domain -


we have server having 2 domains

1) exmaple.co

2) exmaple.com.au

if user hits first domain "example.co"

http://www.exmaple.co or http://exmaple.co should redirect

https://exmaple.co

if user hits second domain "example.com.au"

http://www.exmaple.com.au or http://exmaple.com.au should redirect

https://exmaple.com.au

we have purchase ssl.

we have use framework codeigniter set coding in 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] 

if use above code it's goes on redirect loop.

you getting infinite redirect loop because not preventing redirect happen @ all.

to achieve trying do:

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] 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -