How to redir wildcard subdomains to www


(nudylady) #1

Hi and Merry Xmas:
My current redir to be imported to caddyfile is below

geoip /etc/caddy/GeoLite2-City.mmdb
redir { # geoip
if_op and
if {geoip_country_code} not_match US
if {geoip_country_code} not_match GB
/ https://www.{host}
}

So I can redirect example.com to www.example.com.
Now I would like to redirect wildcard *.example.com to www.example.com.
thanks you for help in advance.


(nudylady) #2

Resolved.
I changed to
/ https://www.{label2}.{label3}{uri}
by looking at this post
Universal redirector