On serving a site on `http://mydomain/2020/` with Grav in `2020/grav`

For posterity:

  1. Create /webroot/2020/grav.
  2. Fill it with candy, ie. a full Grav-installation.
  3. Add a AddType application/x-httpd-ea-php72 .php handler to /webroot/2020/grav/.htaccess because the server defaults to outdated PHP.
  4. Edit / webroot/2020/grav/user/config/system.yaml and add this:
custom_base_url: 'http://domain.tld/2020'
session:
  path: /2020
  1. Create /webroot/2020/.htaccess with:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/2020/grav/
RewriteRule ^(.*)$ /2020/grav/$1
  1. Profit!

A recipe from 2016 actually exists: https://github.com/getgrav/grav/pull/896, even some nice clues in an old forum post: Grav in subfolder without site visitors ever knowing.