# Redirect domain via regex does not work

**URL:** <https://community.traefik.io/t/redirect-domain-via-regex-does-not-work/9975>\
**Category:** Traefik v2\
**Tags:** middleware, docker\
**Created:** [March 8, 2021, 10:18pm UTC](https://community.traefik.io/t/redirect-domain-via-regex-does-not-work/9975 "2021-03-08T22:18:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RogueThorn](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/roguethorn/32/3504_2.png) [@RogueThorn](https://community.traefik.io/u/RogueThorn)\
**Post date:** [March 8, 2021, 10:18pm UTC](https://community.traefik.io/t/redirect-domain-via-regex-does-not-work/9975/1 "2021-03-08T22:18:45Z")

</div>

Heho  
Iˋm trying to redirect a domain to another but it doesnt work. I do not understand why 🙂  
Can you help me please?

I‘m using docker-compose with labels

```auto

labels:
      traefik.enable: "true"
      traefik.docker.network: "weave"
      traefik.http.routers.link.entrypoints: "https"
      traefik.http.routers.link.rule: "HostRegexp(`link.domain.cloud`,`do.gs`,`{subhost:[a-zA-Z0-9-]+}.do.gs`)"
      traefik.http.routers.link.tls: "true"
      traefik.http.routers.link.tls.certresolver: "letsencrypt"
      traefik.http.routers.link.middlewares: "dogs@docker"
      traefik.http.middlewares.dogs.replacepathregex.regex: "^https?://do.gs(.*)"
      traefik.http.middlewares.dogs.replacepathregex.replacement: "https://dogs.ch$$1"
      traefik.http.services.link.loadbalancer.server.port: "80"

```

There are no errors in log or Dashboard . The connection between router and middleware is visible in the dashboard

---

<div class="post-metadata">

**Author:** ![RogueThorn](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/roguethorn/32/3504_2.png) [@RogueThorn](https://community.traefik.io/u/RogueThorn)\
**Post date:** [March 9, 2021, 9:02pm UTC](https://community.traefik.io/t/redirect-domain-via-regex-does-not-work/9975/2 "2021-03-09T21:02:41Z")

</div>

Me stupid

I used replacepathregex instead of redirectregex.

(Insert facepalm here)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [March 12, 2021, 9:03pm UTC](https://community.traefik.io/t/redirect-domain-via-regex-does-not-work/9975/3 "2021-03-12T21:03:20Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
