How I Used Traefik to Redirect a Domain to LinkedIn

A quick guide on how I used Traefik to redirect our new domain straight to LinkedIn. Secure, simple, and ready in minutes.

2 min read

Sometimes, when launching an initiative, you don’t have a full website ready yet—but you still want your shiny new domain name to point somewhere meaningful.

That’s exactly the case for our new event series Pintes et pizzas pour la planète. We recently acquired the domain name pintespizzasplanete.eco 🌍🍕🍺, but while the website is still under construction, we wanted visitors to land on our LinkedIn Showcase Page instead of seeing an empty page.

With Traefik, this turned out to be a very simple task. Let me walk you through how I set up a clean redirection.

The Goal

  • Domain: pintespizzasplanete.eco (and its www variant)
  • Destination: Our LinkedIn Showcase page
  • Requirement: Use HTTPS with Let’s Encrypt and keep the redirection permanent.

The Traefik Setup

I’m running Traefik with Docker Swarm, so the redirection was handled entirely through labels in a simple service definition.

Here’s the full snippet from my docker-compose.yml:

version: "3.8"

services:
  redirect:
    deploy:
      labels:
        traefik.docker.network: "traefik-net"
        traefik.enable: "true"

        # Middleware: regex redirect to LinkedIn
        traefik.http.middlewares.linkedin-redirect.redirectregex.permanent: "true"
        traefik.http.middlewares.linkedin-redirect.redirectregex.regex: ".*"
        traefik.http.middlewares.linkedin-redirect.redirectregex.replacement: "https://www.linkedin.com/showcase/3p-pintes-pizzas-planete/"

        # Router: match our domain and apply middleware
        traefik.http.routers.pintespizzasplanete-redirect.entrypoints: "https"
        traefik.http.routers.pintespizzasplanete-redirect.middlewares: "linkedin-redirect"
        traefik.http.routers.pintespizzasplanete-redirect.rule: "Host(`www.pintespizzasplanete.eco`) || Host(`pintespizzasplanete.eco`)"
        traefik.http.routers.pintespizzasplanete-redirect.tls.certresolver: "letsEncrypt"
        traefik.http.routers.pintespizzasplanete-redirect.tls: "true"

        # Dummy service
        traefik.http.services.pintespizzasplanete-redirect.loadbalancer.server.port: "80"

    image: "traefik/whoami:v1.7.1"
    networks:
      - traefik-net

networks:
  traefik-net:
    driver: overlay
    external: true

How It Works

  1. The middleware (linkedin-redirect) catches all requests (.*) and rewrites them to our LinkedIn URL.
  2. The router listens for pintespizzasplanete.eco or www.pintespizzasplanete.eco, applies the middleware, and ensures TLS certificates are handled by Let’s Encrypt.
  3. The dummy service (whoami) doesn’t actually serve traffic. It just satisfies Docker's requirement to have a backend service defined.

That’s it. Now anyone typing our .eco domain will land directly on our LinkedIn Showcase page, until we’re ready to launch the real site.

Why I Like This Approach

  • Fast to set up: Just a few lines of configuration.
  • Secure by default: HTTPS with Let’s Encrypt handled automatically.
  • Flexible: When the website is ready, I’ll only need to update the router rule to point to the new service instead of LinkedIn.

👉 If you’re running Traefik already, this is probably the simplest way to make sure your domain name always points somewhere useful—even before your website is live.