So it is - I did overlook that point (didn't notice that ssl was involved in the original question)
Although the javascript method will work fine from purely a redirection perspective, you will need to consider the SSL issue. It will require either wildcard cert as Tray suggests (with the same domain part - i.e.
https://mail.domainname.com and
https://www.domainname.com, and
https://domainname.com etc) or you need two IP addresses for the likes of
https://mail.domainname.com and
https://domain2.comAlternatively, you can use just http to hit the redirection script, but have the applications both available under the same ssl web site, i.e:
http://mail.domainname.com -> redirects to ->
https://secure.domainname.com/exchangehttp://domain2.com -> redirects to ->
https://secure.domainname.com/RemoteAlternatively, the users can simply ignore the ssl warnings ;-)
Cheers.