Community discussions

MikroTik App
 
AdminSpeedNet
newbie
Topic Author
Posts: 34
Joined: Thu Jun 04, 2009 3:11 pm

How to redirect after login hotpot

Fri Nov 20, 2009 7:39 am

What can I set automatic redirect to my homepage after login to hotspot? It is kind of advertisement, I think.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: How to redirect after login hotpot

Fri Nov 20, 2009 7:43 am

You have two options:

a) edit alogin.html to directly redirect via a meta refresh, the only HTML in the file should be:
<html><head><meta http-equiv="refresh" content="0;url=http://example.com/" /></head></html>
b) edit the form in login.html that is submitted for login to contain a hidden input element named "dst" with a value of a URI pointing to the final redirect.
 
AdminSpeedNet
newbie
Topic Author
Posts: 34
Joined: Thu Jun 04, 2009 3:11 pm

Re: How to redirect after login hotpot

Fri Nov 20, 2009 7:49 am

I heard unclearly that this is related to Walled Garden feature. Is it so?
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: How to redirect after login hotpot

Fri Nov 20, 2009 7:55 am

No, not at all. The walled garden feature allows you to specify rules that apply to unauthenticated users, allowing them access to resources without logging in.

Read http://www.mikrotik.com/testdocs/ros/2.9/ip/hotspot.php, specifically the section customizing HTTP servlet pages.
request for "/login" page
if user has successfully logged in (or is already logged in), alogin.html is displayed; if alogin.html is not found, redirect.html is used to redirect to the originally requested page or the status page (in case, original destination page was not given)
explains a) - setting a hard redirect in alogin.html forces that pages after successful login, since it will be displayed at that point.
login.html - login page shown to a user to ask for username and password. This page may take the following parameters:
[...]
dst - original URL requested before the redirect. This will be opened on successfull login
explains b) - rewriting that parameter to something hard set replaces the redirect after login with whatever you set it to instead of redirecting to the URL the user originally requested.
 
AdminSpeedNet
newbie
Topic Author
Posts: 34
Joined: Thu Jun 04, 2009 3:11 pm

Re: How to redirect after login hotpot

Sat Nov 21, 2009 5:34 am

It work as expected when I change dst at the bottom of the login.html script. Thanks for your support.
 
User avatar
Thor187
Frequent Visitor
Frequent Visitor
Posts: 50
Joined: Sat Oct 21, 2017 10:21 pm

Re: How to redirect after login hotpot

Tue Feb 26, 2019 1:25 pm

You have two options:

a) edit alogin.html to directly redirect via a meta refresh, the only HTML in the file should be:
<html><head><meta http-equiv="refresh" content="0;url=http://example.com/" /></head></html>
b) edit the form in login.html that is submitted for login to contain a hidden input element named "dst" with a value of a URI pointing to the final redirect.
Does option B work on a modern android phone, I tested with a Samsung S6 and Note 9 does not redirect, not sure if I am missing something or if android changed since this post 10 years ago.