This is a follow-on from this post. I’ve migrated from v1 to v2 except for this rewrite:
example.blog {
redir /feed https://blog.example.com/feed.xml 301
rewrite / {
r ^/(\d+){3}/(.*)
to {2}
}
redir / https://search.example.com/search?query=site%3Ablog.example.com+{2}
}
The redir /feed works fine. It’s the rewrite which fails. The error from caddy v2 is:
run: adapting config using caddyfile: parsing caddyfile tokens for 'rewrite': Caddyfile:46 - Error during parsing: Wrong argument count or unexpected line ending after 'rewrite'
I’ve tried to do it in direct redir and uri but they both fail because I think it should parse the old html file name from the old /YYYY/MM/DD/blog-post.html uri structure. I’ve also tried rewrite * rather than rewrite /.
I just named the matcher and the regexp foo here, because I don’t know exactly the purpose of the rewrite, but I’m sure you can come up with something better.