Hi all,
I recently switched to Traefik using Docker and It's been a breeze.
The only thing I have yet to figure out is how I would go about directing my main domain name to a subdomain.
I tried setting an HTTP redirect middleware without success (this is from the docker-compose.yml
of the Traefik container:
labels:
- "traefik.enable=true"
- "traefik.http.routers.domain.entrypoints=websecure"
- "traefik.http.routers.domain.rule=Host(`example.com`)"
- "traefik.http.routers.domain.service=noop@internal"
- "traefik.http.routers.domain.middlewares=subdomain-redirect"
- 'traefik.http.middlewares.subdomain-redirect.redirectregex.regex=^http://example.com/(.*)'
- 'traefik.http.middlewares.subdomain-redirect.redirectregex.replacement=http://subdomain.example.com/$${1}'
- "traefik.http.middlewares.subdomain-redirect.redirectregex.permanent=true"
I realise there are plently of similar questions around the web, but I could not figure it out...
I've tried several variations of the code above without success.
How should I go about redirecting my main domain to a subdomain?
Any pointers would be greatly appreciated.
Thank you!