Hello ![]()
I’d like to share how I revamped our forum’s visitor flow. Since our community centers around e-cigarettes, legal regulations and strict 18+ age restrictions require us to keep our topics hidden from the general public. If a visitor tries to open any unauthorized page on our forum, the system blocks access and redirects them to the /login page.
While this rule sounds simple enough, it caused serious UX headaches, which I’ve finally smoothed out using some custom logic.
Why aren’t we using the built-in “Login Required” setting?
The most obvious solution would have been to simply enable the global lock in the admin panel. However, we couldn’t do that for one massive reason: SEO.
If we use the built-in lock, Discourse shuts the door on search engine crawlers (Googlebot, Bing, etc.) as well. This means the forum would lose its rankings on Google, causing us to completely vanish from search results and AI recommendations.
Bots get through and index the content normally, while human visitors are stopped and redirected to the login screen.
The Problem: Lost Visitors
Our custom gateway used to have one major flaw:
The destination was lost: If someone clicked a specific topic from Google, the gateway redirected them to sign in immediately. The visitor lost the exact article they came for because they only saw a login page, causing many to close the site immediately (resulting in a high bounce rate).
The Solution: How the flow works now
We have now made this journey completely frictionless. When a guest arrives via an external link, here is what happens behind the scenes:
-
Visual teaser (Topic preview card): To avoid hitting the visitor with a cold login wall, an info card appears right above the login form. This instantly pulls in the requested topic’s title, cover image, a short text snippet, the author, and the reply count. This way, the user sees exactly why it’s worth logging in.
-
Instant redirection to the content: Once the user logs in or registers, Discourse automatically redirects them straight back to the specific topic they wanted to read.
With this logic, the forum remains 100% compliant with strict age-restriction laws, Google can index the pages without a hitch, and the preview card shows visitors exactly what they are unlocking, giving them a clear reason to log in.
