So, I have a plugin that redirects users, using jQuery/Javascript, to a specified page as follows:
window.location.href = window.location.hostname + '/index.php/searchresults-gw/'
When the plugin is referenced from any page other than the home page, 192.1.0.2/pagename/
for example, then the user is correctly redirected to 192.1.0.2/index.php/searchresults-gw/
.
But when the same plugin is referenced from the home page (192.1.0.2), the url tries to resolve to 192.1.0.2/192.1.0.2/index.php/searchresults-gw/
What am I overlooking here?
window.location.href = ‘http://’ + window.location.hostname + ‘/index.php/searchresults-gw/’