diff --git a/main.py b/main.py index d8b80598..641567dd 100644 --- a/main.py +++ b/main.py @@ -332,6 +332,24 @@ logger.info("=" * 80) logger.info("ROUTE REGISTRATION (AUTO-DISCOVERY)") logger.info("=" * 80) +# ============================================================================= +# EXPLICIT REDIRECTS for paths that clash with the CMS /{slug} catch-all +# ============================================================================= +# The CMS catch-all /{slug} at root level intercepts /merchants, /admin, etc. +# (without trailing slash) before FastAPI can redirect to the prefixed routers. +# These explicit routes ensure clean URLs work. + + +@app.get("/merchants", include_in_schema=False) +async def merchants_redirect(): + return RedirectResponse(url="/merchants/", status_code=301) + + +@app.get("/admin", include_in_schema=False) +async def admin_redirect(): + return RedirectResponse(url="/admin/", status_code=301) + + # ============================================================================= # PLATFORM PAGES (Marketing pages - homepage, pricing, signup, etc.) # =============================================================================