Page 1 of 1

How to redirect after login hotpot

Posted: Fri Nov 20, 2009 7:39 am
by AdminSpeedNet
What can I set automatic redirect to my homepage after login to hotspot? It is kind of advertisement, I think.

Re: How to redirect after login hotpot

Posted: Fri Nov 20, 2009 7:43 am
by fewi
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.

Re: How to redirect after login hotpot

Posted: Fri Nov 20, 2009 7:49 am
by AdminSpeedNet
I heard unclearly that this is related to Walled Garden feature. Is it so?

Re: How to redirect after login hotpot

Posted: Fri Nov 20, 2009 7:55 am
by fewi
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.

Re: How to redirect after login hotpot

Posted: Sat Nov 21, 2009 5:34 am
by AdminSpeedNet
It work as expected when I change dst at the bottom of the login.html script. Thanks for your support.

Re: How to redirect after login hotpot

Posted: Tue Feb 26, 2019 1:25 pm
by Thor187
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.