Platform.sh is now Upsun. Click here to learn more
Upsun Fixed User Documentation

Serve directories at different paths

Try Upsun for 15 days
After that, enjoy the same, game-changing Upsun features for less with the First Project Incentive!¹ A monthly $19 perk!
Activate your 15-day trial
¹Terms and conditions apply

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
  applications.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:

.platform.app.yaml
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.