Skip to content

Instantly share code, notes, and snippets.

@teslamint
Last active January 24, 2018 05:41
Show Gist options
  • Save teslamint/2f71932e1cdb38ea362f9cb68c5a12b5 to your computer and use it in GitHub Desktop.
Save teslamint/2f71932e1cdb38ea362f9cb68c5a12b5 to your computer and use it in GitHub Desktop.
Ubiquiti UniFi Guest Portal Redirect to External Server
<html>
<head>
</head>
<body>
<script type="text/javascript">
var site = decodeURIComponent(window.location.pathname), url = "YOUR_URL_HERE"
+ (window.location.search.indexOf('?') === -1 ? '?' : '')
+ window.location.search
// customize parameters with your needs
+ '&cip=' + window.location.hostname
+ '&cport=' + window.location.port
+ '&site=' + encodeURIComponent(site.replace('/guest/s/', '').replace('/', ''));
window.location.replace(url);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment