Do not redirect to 404, when subpage is missing?

I have .md content for the services page, with a personal layout.
Hugo generates me site.com/services page. When visitors go to site.com/services/seo, they receive 404 page (reasonable). Is there any way to respond with the services page and save in browser URL string site.com/services/seo.

I need this for manual processing unexisting pages and dynamically creating them with JS.

You can add frontmatter alias to the page you wish to redirect to.

alias:
- /services/seo

in the service.md file (or where ever you define the service section) should do the trick.

This is a good solution when I know the subpages’ URLs. But I don’t. Basically, I get content for them via REST API. I need something that is described here, but I think for me is enough just redirect to root page