Redirect domain name to FQDN + path

Hello there,

I am trying to redirect a request on my domain example.org to something like xxx.example.org/path/x.

These are the labels from the service that is affected. Hope that's enough otherwise let me know what else I should add.

traefik.http.routers.<service>.middlewares: default@file,test-redirect
traefik.http.middlewares.test-redirect.regex: ^http(s)://example.org
traefik.http.middlewares.test-redirect.replacement: https://example.org/path/x

Thanks in advance.

This one works, removes www.:

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

Maybe you need to escape the ., using \..

Not sure if the (s) works, you could create a second middleware for that if needed.

I am sorry but I think you misunderstood... I do not want to remove www.. I would like to redirect from
example.org to example.org/path/x so it should redirect to a path.

BTW do you have a documentation URL for this $${1} things?
And last but not least. Were I correct about adding test-redirect to the middlewares like I did?

Thank you

$${1} is escaped ${1}, which contains the captured characters from (.*).

Try this

traefik.http.middlewares.test-redirect.regex: ^http(s)://example.org(/)$$
traefik.http.middlewares.test-redirect.replacement: https://example.org/path/x