Setup modx friendlyurls on caddy

I just can’t get it work, i don’t know how to make it right.
Here are some examples:
Lighttpd Lighttpd Guide - Using Friendly URLs | MODX Documentation

if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php?q=$1 last;


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

How to write it on caddy? i’m ready to test on my side

A post was merged into an existing topic: Rewrite nginx “rewrite block” to caddy