RedirectRegex not working: www.subdomain.domain.com → subdomain.domain.com

Hey there, been puzzling with Traefik for the last few days.

I've got most things working except the my last redirect.

In the following file, the middleware to redirect for example www.test.kennis.shop to test.kennish.shop (remove the www. ) doesn't seem to work: it loads the URL including www. and throws an SSL error.

This is the traefik_conf.yml:

http:
  routers:
   
    # load website with both domains
    kennisshop:
      service: subdomains
      priority: 1
      rule: "Host(`kennis.shop`, `smartclasses.app`)"
      tls:
        certResolver: leresolver
        domains:
          - main: "kennis.shop"
            sans:
              - "*.kennis.shop"
              - "smartclasses.app"
              - "*.smartclasses.app"


    #  Redirects www.kennis.shop to kennis.shop - and loads subdomain with wildcard resolver
    kennisshop-www: 
      rule: "HostRegexp(`{subdomain:[a-z]+}.kennis.shop`) || HostRegexp(`{subdomain:[a-z]+}.smartclasses.app`)" # If the rule matches, apply the middleware
      service: subdomains
      middlewares: 
      - redirect-www-kennisshop
      - redirect-www-smartclasses
      priority: 2
      tls:
        certResolver: myresolver
        domains:
          - main: "kennis.shop"
            sans:
              - "*.kennis.shop"
              - "smartclasses.app"
              - "*.smartclasses.app"

    # Redirect all www.subdomain.kennis.shop to remove the www. - NOT WORKING
    kennisshop-www-subdomains: 
      priority: 3
      middlewares: 
      - redirect-www-subdomain-kennisshop
      - redirect-www-subdomain-smartclasses
      service: subdomains
      rule: "HostRegexp(`www.{subdomain:[a-z]+}.kennis.shop`) || HostRegexp(`www.{subdomain:[a-z]+}.smartclasses.app`)" 
      tls:
        certResolver: myresolver
        domains:
          - main: "kennis.shop"
            sans:   
              - "*.kennis.shop" 
              - "*.kennis.shop"
              - "smartclasses.app"
              - "*.smartclasses.app"
  
  services:
    subdomains:
      loadBalancer:
        servers:
          - url: "http://smartclasses.app:49154/"
  
  middlewares: ##define middlewares
  # remove www from kennisshop
    redirect-www-kennisshop: # remove www.
      redirectRegex:
        regex: "^https://www.kennis.shop/(.*)"
        replacement: "https://kennis.shop/${1}"
  # remove www from smartclasses
    redirect-www-smartclasses: # remove www.
      redirectRegex:
        regex: "^https://www.smartclasses.app/(.*)"
        replacement: "https://smartclasses.app/${1}"

    redirect-www-subdomain-kennisshop: ##redirect www.subdomain from kennis.shop
      redirectRegex:
        regex: "^https://www.{subdomain:[a-z]+}.kennis.shop/(.*)"
        replacement: "https://{subdomain:[a-z]+}.kennis.shop/${1}"
        permanent: true 

    redirect-www-subdomain-smartclasses: ##redirect www.sbudomain from smartclasses.app
      redirectRegex:
        regex: "^https://www.{subdomain:[a-z]+}.smartclasses.app/(.*)"
        replacement: "https://{subdomain:[a-z]+}.smartclasses.app/${1}"
        permanent: true 

I can see the middleware function well in the dashboard:

Also, the other redirect (from www.kennis.shop to kennis.shop) works perfectly.
Any idea what's going wrong?

Not sure how to debug the exact steps Traefik is taking.