Help to migrate Caddyfile V1 to V2 for Nextcloud

Okay I think I’ve thought through a solution – the general idea is to add a split feature to the file matcher, it would look something like this:

file {
    split .php
    try_files {path} {path}/index.php index.php
}

I’ll work on implementing that soon, we’ll see if we can get that into Caddy ASAP, but no promises.

That said, here’s a potential temporary solution for you:

@phpFiles {
    path_regexp phpfile ^/(remote|public|cron|core/ajax/update|status|ocs/v1|ocs/v2)\.php
}
rewrite @phpFiles {http.regexp.phpfile.0}

Essentially this should act as a whitelist for those PHP files that shouldn’t be rewritten to index.php.

1 Like