info_i_25x25.png See important information about Ubiquiti Devices and KRACK Vulnerability in this article. We will update this document as more information becomes available.

UniFi - Guest Portal Promotional URL Automatic Redirection

 Overview


Readers will learn how to customize the built-in UniFi portal to automatically redirect guests to the Promotional URL/Site by just connecting to the AP/Guest WiFi. 

info_i_25x25.png Notes & Requirements

- Firmware Version Applicable: UniFi Controller v4+
- Device Models Applicable: All
- Requirements:
  - User must have UniFi Controller Installed.
  - User must have a Guest Network Setup.
  - Some commands below may require escalated permissions, so it is recommended to run the command "sudo -s" The following command will put the user into a root shell allowing them to execute commands with root-level permissions.

Table of Contents


  1. Settings in the UniFi Controller
  2. How to Modify the Portal (Linux)
  3. Related Articles

Settings in the UniFi Controller 


Back to Top

Step 1: Open the Settings tab in the UniFi Controller

Step 2: Click on the Guest Control tab on the right-hand side

Step 3: Enable Guest Portal by clicking the checkbox

Step 4: Set the Authentication type to "No Authentication"

Step 5: Set the Landing Page to Promotional URL.

Step 6: Enable Portal Customization by clicking the checkbox

Step 7: Click the Apply button at the bottom right-hand side.


How to Modify the Portal(Linux)


Back to Top

Step 1: Navigate to the /var/lib/unifi/sites/default/portal/ with command "cd /var/lib/unifi/sites/default/portal/"

Step 2: Move "index.html" to "index.html.orig" for backup purposes with command "mv index.html index.html.orig"

Step 3: Now using your favorite editor(nano, vi, gedit, etc) create a new file index.html with command "vi index.html"

Step 4: Copy the following index.html code into your editor:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
  <title><unifi txt="WelcomePage.Title" /></title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <link rel="stylesheet" type="text/css" href="<unifi url="reset-min.css"/>" />
  <link rel="stylesheet" type="text/css" href="<unifi url="styles.css"/>" />
  <script type="text/javascript" src="<unifi url="js/jquery.min.js"/>"></script>
  <script type="text/javascript" src="<unifi url="js/guest.js"/>"></script>
</head>
<body class="login-page">
<!-- see README.txt for HTML customization instructions -->
 
<form name="input" id="input" method="post" action="login">
</form>
 
<script type="text/javascript">
document.getElementById("input").submit();
</script>
 
</body>
</html>

Step 5: Save the file if using vi "hit esc :wq enter" vi specific, make this generic

Step 6: Now restart the UniFi Service by running the following command "service unifi reload"

When a guest connects to the guest network the guest will automatically be authorized and redirected to your promotional URL without accepting the Terms & Conditions.

A new feature introduced in UniFi version 3 is Multi-Site Management. Read our UniFi - Configuring Multiple Sites article to learn how to create a new site. 


Related Articles


Back to Top

UniFi - Wireless Guest Network Setup

UniFi - What happens with the guest portal when the controller goes offline?