Serve directories at different paths

In some cases you might want to depart from the common practice of serving directories directly. You might want to create a URL structure different than the structure on your disk.

For example, in Git you might have a folder for your app and another folder that builds your documentation. Your entire Git repository might look like the following:

.platform/
  routes.yaml
  services.yaml
.platform.app.yaml
application/
  [app-code-files]
docs-src/
  [docs-code-files]

And your build process might build the documentation with an output folder such as docs-public.

If so, you can serve all requests by your app code except for those that start with /docs, which you serve with your generated docs. Use a web configuration similar to the following:

web:
    locations:
        '/':
            passthru: true
        '/docs':
            root: 'docs-public'
            index:
                - "index.html"
            expires: 24h
            scripts: false
            allow: true

This way, your app can safely coexist with static files as if it were a single site hierarchy. And you can keep the static pages separate from your app code.