# Traefik. Redirections

**URL:** <https://community.traefik.io/t/traefik-redirections/23029>\
**Category:** Traefik v2\
**Tags:** docker, middleware\
**Created:** [June 2, 2024, 10:02pm UTC](https://community.traefik.io/t/traefik-redirections/23029 "2024-06-02T22:02:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![illusior](https://avatars.discourse-cdn.com/v4/letter/i/e19adc/32.png) [@illusior](https://community.traefik.io/u/illusior)\
**Post date:** [June 2, 2024, 10:02pm UTC](https://community.traefik.io/t/traefik-redirections/23029/1 "2024-06-02T22:02:13Z")

</div>

question is posted here: [docker - Traefik. Redirections - Stack Overflow](https://stackoverflow.com/questions/78564977/traefik-redirections)

please, help

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 3, 2024, 6:03am UTC](https://community.traefik.io/t/traefik-redirections/23029/2 "2024-06-03T06:03:44Z")

</div>

In general I would recommend to post all content here and also start with the question, not let people read 3 pages of config first before even knowing the question and what to look for.

Update Traefik to use a recent version, v2.3 is from 2020. When going to v3, `Host()` will only accept a single domain.

This is how [simple Traefik example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt) redirects:

```auto
  whoami:
    image: traefik/whoami:v1.10
    networks:
      - proxy
    labels:
      - traefik.enable=true
      - traefik.http.routers.mywhoami.rule=Host(`whoami.example.com`) || Host(`www.whoami.example.com`)
      - traefik.http.services.mywhoami.loadbalancer.server.port=80

      - traefik.http.middlewares.mywwwredirect.redirectregex.regex=^https://www\.(.*)
      - traefik.http.middlewares.mywwwredirect.redirectregex.replacement=https://$${1}
      - traefik.http.routers.mywhoami.middlewares=mywwwredirect

```
