How to port 'old' Caddyfile for bilingual website

That’s my ‘old’ Caddyfile (for Caddy v1):

http://fantasy.de:8080 {
    root /home/fantasymaps/fantasywebsite/fantasy.de
    gzip
    log ./access.log {
      ipmask 255.255.0.0 ffff:ffff:ffff:ff00::
    }
    errors ./error.log
    rewrite {
      if {path} not_match ^/de.*
      if {path} not_match ^/en.*
      if {>Accept-Language} match ^de.*
      to /de{uri} {path}
    }
    rewrite {
      if {path} not_match ^/de.*
      if {path} not_match ^/en.*
      if {>Accept-Language} not_match ^de.*
      to /en{uri} {path}
    }
}

Purpose: Depending on the (browser) language settings an english or a german version of the website is called.

Question: How to port this to Caddy v2?

You’ll find this section of the documentation useful in converting the V1 Caddyfile Upgrading to Caddy 2 — Caddy Documentation

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.