Parse error: Invalid redirect code

Caddyfile:
redir /blog/wp-content/uploads/2010/12/Bildschirmfoto-2010-12-14-um-19.47.29-1024x640.png /images/celtx_auf_osx_wortspiele_polysemia.thumbnail.png

Error:
caddy[8444]: 2016/07/17 00:57:32 Caddyfile:23 - Parse error: Invalid redirect code '/images/celtx_auf_osx_wortspiele_polysemia.thumbnail.png'

when i understand the example right that should work.

what am i doing wrong?

I fixed it by only using the redir directive once but with multiple urls.

You’re missing the redirect code; the example uses 307.

Default is 301 Moved Permanently.

and that is what i want. in what case do i have to set it explicitly?

Oh, umm maybe that’s not true for the table form. I’ll double check and make the fix.

Okay, so actually this isn’t a bug; using this format: redir from to code, all 3 values are required. This is still correct in the docs because the code parameter doesn’t have those optional [ ] brackets around it. The default code is still 301, but only when the syntax allows it to be omitted.

I’ll try to clear that up in the docs.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.