N
na
Hello everyone,
I have the following code which works very well:
<script language="javascript" type="text/javascript" >
// This is the hostname that will trigger enforcement of redirection.
var enableRedirect = true;
// This is the hostname that will trigger enforcement of redirection.
var externalHostname = "www.exelonenergy.com";
// This is the reconstructed URL if the current URL contains the
externalHostname:
var redirectURL = "https://" + externalHostname + "/" +
window.location.pathname;
// If the URL contains the externalHostname specified above,
// and the protocol in plain http:, then redirect to the https:
equivalent:
if (enableRedirect == true)
{
if (window.location.hostname.indexOf(externalHostname) >= 0)
{
if (window.location.protocol == "http:")
{
window.location.href = redirectURL;
}
}
}
</script>
What I need though, is the user to be directed if they type in the URL
without the www.
Any help would be great, thanks
I have the following code which works very well:
<script language="javascript" type="text/javascript" >
// This is the hostname that will trigger enforcement of redirection.
var enableRedirect = true;
// This is the hostname that will trigger enforcement of redirection.
var externalHostname = "www.exelonenergy.com";
// This is the reconstructed URL if the current URL contains the
externalHostname:
var redirectURL = "https://" + externalHostname + "/" +
window.location.pathname;
// If the URL contains the externalHostname specified above,
// and the protocol in plain http:, then redirect to the https:
equivalent:
if (enableRedirect == true)
{
if (window.location.hostname.indexOf(externalHostname) >= 0)
{
if (window.location.protocol == "http:")
{
window.location.href = redirectURL;
}
}
}
</script>
What I need though, is the user to be directed if they type in the URL
without the www.
Any help would be great, thanks