Docker redirect WWW to Non WWW


I have installed ERPNext using docker,

But I have noticed that WWW site gives a 404 error and without WWW it works normally.

How can I redirect WWW to NON WWW ?

This is the 404 error for WWW


can you share details about setup?

how many sites you have?

if you’re using traefik check Traefik RedirectRegex Documentation - Traefik

these labels need to go under frontend container, you can create additional override compose file for that.

Note: Host header and directory name of site created must match.

@revant_one I have followed exactly these steps in Ubuntu 20.04 instance. Currently, I have only one site.

  - "traefik.http.middlewares.test-redirectregex.redirectregex.regex=^*)"
  - "traefik.http.middlewares.test-redirectregex.redirectregex.replacement=$${1}"

Does the above look correct?

you may need to apply the middleware with 1 more label

refer Traefik Proxy Middleware Overview - Traefik