Good news and bad news: gitea seems to lack builtin functionality to set the home page to any arbitrary URL at the moment. Furthermore, there doesn’t seem to be any way to redirect the home page for logged-in users without sacrificing important UI functionality (the user’s dashboard) because said functionality seems to be exposed only at the home page url. I may be wrong here, so please correct me if I am.
This throws simple unconditional redirects off the table since it will also affect logged in users.
The good news: If you just want to redirect users who aren’t logged-in to the explore page or the organizations page, you can achieve this by setting LANDING_PAGE to either explore or organizations, respectively. This option should be set under the [server] block.
Devs who want to only redirect users that are not logged-in to an arbitrary url can do so by simply adding a redirect in the home.tmpl file in your custom/templates directory (see Customizing Gitea for more information). I’ve included the contents of my edited home.tmpl file here if anyone’s interested. It redirects to the explore page, but the url can point to any other url.
If you want to redirect to a page inside gitea, make sure you use the {{AppSubUrl}} prefix instead of naked relative links. If you don’t, links will break if you ever move gitea to a subpath.
This redirect will gracefully degrade for users who disable javascript; the redirect won’t be automatic, but users wont be stranded either.
I’ll update here if I ever manage to find a more proper solution.
Cheers!
Edit 1: Edited to reflect the information provided in @oscarlo’s post bellow.
I swear I’ve looked at app.ini.sample more times than I’d care to recount, but I somehow ended up missing this option every single time. It isn’t a general redirect, but it achieves what I wanted. Thank you so much for drawing attention to LANDING_PAGE !
I’ll edit my previous post to reflect the information you provided.