Просмотр поста #562136: JohnCMS 9.9: Migrating Old Custom Modules Using ?act= to the New Routing System

.
Simba
Кадило крутится, лавэха мутится

There's nothing wrong with the code you posted.
So the 404 is coming from outside the file you showed, and the key question is which 404 you're seeing:

  • If it's the styled JohnCMS 404 page, the request reached index.php but the route didn't match.
  • If it's a plain 404 Not Found from the web server (nginx/apache), then /stats is never being forwarded to the front controller index.php at all — that's a web server rewrite issue, not a module issue.

The fastest way to tell them apart is to list the registered routes from the CLI:

php system/bin/console router:list

If /stats appears there, your module config is fine and the problem is in the web server rewrite rules. If it doesn't appear, the routes file isn't being loaded — in that case check the logs in data/ for a fatal error while loading one of the modules' routes.php.

Let me know which 404 you get and whether /stats shows up in router:list, and we can narrow it down from there.