Docker redirect WWW to Non WWW

Hello,

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 ?

image
This is the 404 error for WWW

Anyone?

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=^https://www.domain.com/(.*)"
  - "traefik.http.middlewares.test-redirectregex.redirectregex.replacement=https://domain.com/$${1}"

Does the above look correct?

you may need to apply the middleware with 1 more label

refer Traefik Proxy Middleware Overview - Traefik