Apply another entrypoint by router-rule

Hi, I'm looking for a possibility to route a subfolder to anoter entrypoint (for hiding wp-admin for example). Is this possible, and when yes...how? (with labels)

What do you can a "subfolder": a sub-domain or a path?

path: like -> test.com/wp-admin and all its subfolders

so you can easy hide wp-admin, and restrict it to several ips for example...

You can use the PathPrefix matcher.

https://docs.traefik.io/v2.1/routing/routers/#rule

version: '3.7'

services:
  traefik:
    image: traefik:v2.2
    command:
      - --log.level=INFO
      - --api
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      traefik.enable: true

      # Dashboard
      traefik.http.routers.traefik.rule: Host(`traefik.localhost`)
      traefik.http.routers.traefik.entrypoints: web
      traefik.http.routers.traefik.service: api@internal

  whoami:
    image: containous/whoami:v1.5.0
    labels:
      traefik.enable: true

      traefik.http.routers.app.rule: Host(`whoami.localhost`)
      traefik.http.routers.app.entrypoints: web

      traefik.http.routers.app_admin.rule: Host(`whoami.localhost`) && PathPrefix(`/admin`)
      traefik.http.routers.app_admin.entrypoints: web

https://docs.traefik.io/v2.2/routing/routers/#priority

would a regex also do it?

traefik.http.routers.wordpressbackend.rule: HostRegexp(`^\/(?!wp-login|wp-admin).*\.php$$`)

Okay I found out that the rule works, but wp-admin is still accessible over the other entrypoint also...how can I prevent that? Also the problem is, that it redirect to wp-login.php witch is in the root directory...how has to be the rule for this file to restrict?

Can you help me out with thisone? Traefik rule for accessing a special file inside a directory

I tried your way, it's not working as expected. The admin subfolder is still accessible on the normal entrypoint...