caddy2重定向方法

1. Blanket Redirect

Redirect the entire HTTP version of the site:

http://example.com {
  redir https://{host}{uri} permanent
}
https://example.com {
    ....
}

Copy

2. Schema Redirect

Check for HTTP scheme, and redirect:

http://example.com, https://example.com {
  redir {
    if {scheme} is http https://{host}{uri}
  }
  
  ....
}

Copy

3. Subdomain Redirect

Check subdomain, and redirect:

www.example.com {  
  redir https://example.com{uri} permanent
}
http://www.example.com {
  redir https://example.com{uri} permanent
}
https://www.example.com {
  redir https://example.com{uri} permanent
}
https://example.com {
    ....
}

Comments

No comments yet. Why don’t you start the discussion?

发表回复