Link to home
Start Free TrialLog in
Avatar of loveboatexpress
loveboatexpressFlag for United States of America

asked on

http redirect depending on URL / Domain / Location of htm file

this is a very similar question to:
https://www.experts-exchange.com/questions/21623909/conditional-http-redirect-depending-on-URL-Domain.html 

However in this situation, the page might be accessed by unc path or mapped drive.

X:\company\intranet\index.htm

This is fine, but I would like to redirect the browser to:

https://alias.domain.tld/folder/index.htm 

where folder is a virtual directory of an SSL enabled webserver that points back to X:\company\website\


This doesn't work, but the concept is correct:

if (window.location.hostname != "https://alias.domain.tld/folder/index.htm")
{
     window.location.replace(window.location.href.replace(window.location.hostname, "https://alias.domain.tld/folder/index.htm"));
}
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of loveboatexpress

ASKER

perfect.  Thank you.