flies
(flies)
1
Hello,
I am trying to figure out, if such behaviour is optimal for caddy.
It handles redirecting with query string when using urls without final slash.
Simple:
redir "/random-dummy-url" "/other-url{query}" permanent
failed. Question mark was missing.
Or maybe there is better option than below?
map {query} {cond_query} {
~(.+) "?${1}"
default ""
}
# from plain redirect id 7
redir "/random-dummy-url" "/other-url{cond_query}" permanent
1 Like
{query}
doesn’t include the ?
, it’s only the part after the ?
. So you need to add ?
yourself in the redirect target. Like /other-url?{query}
You can use a matcher to check if there’s any query and choose what to do based on that:
handle /random-dummy-url {
@dummy-has-query `{query} != ""`
redir @dummy-has-query /other-url?{query} permanent
redir * /other-url permanent
}
1 Like
system
(system)
Closed
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.