I don’t believe try_files
accepts a matcher. The syntax is:
try_files <files...>
It’s not a true directive, in the sense that try_files
does not directly configure its own specific module. Instead, it’s effectively a kind of common shorthand for a longer snippet of Caddyfile config:
The
try_files
directive is basically a shortcut for:@try_files { file { try_files <files...> } } rewrite @try_files {http.matchers.file.relative}
So you could use the long-form instead and add a path
matcher to @try_files
, which would get you what you’re after.
Basically, along the same kind of lines you were getting at here: Problem with old Kirby 2 Panel rewrites in Caddy v2 - #5 by WoofDog
Except, use /panel/*
instead of /panel
(path matching is exact, as @francislavoie mentioned in the comment immediately following yours). And use {path} {path}/ /panel/index.php?{query}
(which you said works) instead of {path} /index.php
(which you said doesn’t).