diff --git a/htdocs/www/js/errorpages/homepage.js b/htdocs/www/js/errorpages/homepage.js index bd3925d..b52be9f 100644 --- a/htdocs/www/js/errorpages/homepage.js +++ b/htdocs/www/js/errorpages/homepage.js @@ -1,6 +1,16 @@ -function homepage() { - let proto = location.protocol; +function homepage(getURI) { + let baseURI = getURI; let port = location.port; - let currentSite = window.location.hostname; - window.location = proto + '//' + currentSite + ':' + port; + let url = location.hostname; + let proto = location.protocol; + let baseURL = baseURI || location.pathname; + let base = baseURL.slice(0, baseURL.lastIndexOf('/')); + if (!base) base = '/'; + if (!port) + if (proto == 'https:') { + port = 443; + } else { + port = 80; + } + window.location = proto + '//' + url + ':' + port + base; }