How to redirect after login hotpot

What can I set automatic redirect to my homepage after login to hotspot? It is kind of advertisement, I think.

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.

I heard unclearly that this is related to Walled Garden feature. Is it so?

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.

It work as expected when I change dst at the bottom of the login.html script. Thanks for your support.

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.