I am trying to configure a rewrite rule in Caddy web server:
From: /data/id/name.html
To: /data.py?id=id&name=name
I have tried different approaches:
rewrite /data/([^/]+)/([^/]+)\.html /data.py?id={1}&name={2}
This does not work and returns the homepage
rewrite /data/(\d+)/([A-Za-z0-9_-]+)\.html /data.py?id={1}&name={2}
This also brings me to the homepage
rewrite ^/data/(\w+)/(\w+)\.html$ /data.py?id={1}&name={2}
This fails and Caddy won't start due to an error
rewrite /data { r ^/(\w+)/(\w+)\.html$ to /data.py?id=$1&name=$2 }
Also fails when Caddy won't start.How do I configure it correctly?And why creating rewrite rules always fails to me; I know I am not smart :-) but I think it shouldn't be that difficult.