fortropp.toml

/fortropp.toml is an optional config file that lives at the root of your uploaded files, generated by default or uploaded like any other file. It controls which subdirectory is served as your site's root, and lets you define redirects and custom response headers.

An auto-generated reference of every key and type is at fortropp.toml schema.

Default behaviour

Every new website starts with a generated fortropp.toml that serves the top level of your files, sends /blog to /blog/ when /blog/index.html exists, serves /about.html at /about, and sends missing pages to your /404.html:

version = 1

[build]
publish = "/"
trailing_slash = "add"

[[redirects]]
from = "/*"
to = "/:splat.html"
# e.g. /about serves /about.html, /docs/intro serves /docs/intro.html
status = 200

[[redirects]]
from = "/*"
to = "/404.html"
status = 404

If you delete the file, default rules apply instead: the site root is served from the top level of your uploaded files, and no redirects (including the 404 page) or extra headers are applied.

Either way, / and any path ending in / serve that directory's index.html; that's built in and needs no rule. For example, / serves /index.html and /blog/ serves /blog/index.html.

If the fortropp.toml file exists but fails to parse, that's treated as an error at upload time rather than invisibly falling back to the default rules. Unknown keys are errors too, so a typo like [[redirect]] or publsh is caught instead of silently ignored.

Version

Every fortropp.toml starts with version = 1, at the top of the file before any [section]. 1 is the only version, and a file without it is an error. The generated file already has it.

Paths

Every local path in this file follows the same rules:

  • It starts with /. A trailing / is allowed.
  • No relative or empty segments: ., .. and // are errors.
  • * is only allowed as the whole last segment, as in /blog/*, and only in from and for. /blog*, /*/edit and /a/** are errors.

to in [[redirects]] can also be a URL: https://, then a domain name (no IP addresses or localhost), an optional :port, and an optional path and query. The host must be lowercase, and there can't be a user@ or user:password@ part before it. The path follows the same rules as a local path.

Paths may contain any characters. A request for /caf%C3%A9.html and a rule written as /café.html name the same file, and a percent-encoded %3F or %23 is part of a file name (/a%3Fb serves the file /a?b), never the start of a query. An encoded slash (%2F) is never treated as a folder separator.