# All subdirectories return 404

**URL:** <https://community.traefik.io/t/all-subdirectories-return-404/9108>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [December 23, 2020, 11:29am UTC](https://community.traefik.io/t/all-subdirectories-return-404/9108 "2020-12-23T11:29:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![kevinpollet](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/kevinpollet/32/1755_2.png) [@kevinpollet](https://community.traefik.io/u/kevinpollet)\
**Post date:** [December 23, 2020, 3:28pm UTC](https://community.traefik.io/t/all-subdirectories-return-404/9108/2 "2020-12-23T15:28:29Z")

</div>

Hello @transistor,

Thanks for your interest in Traefik!

As the forwarded request contains the `/portainer` path a `404 Not Found` error is returned by Portainer because it does not exist.

To remove the `/portainer` path from the forwarded request you can use the [strip prefix middleware](https://doc.traefik.io/traefik/middlewares/stripprefix/). The following labels have to be added to the portainer container:

```auto
- "traefik.http.routers.portainer-secure.middlewares=portainer-stripprefix"
- "traefik.http.middlewares.portainer-stripprefix.stripprefix.prefixes=/portainer"

```

With those labels, the `404` error is fixed but the portainer UI is not loading properly.

That's because the UI requests don't contain the portainer path (which is required to match the `router` rule). It seems that it's currently not possible to configure portainer to add this prefix: [[FEAT] Add path prefix to web UI · Issue #3901 · portainer/portainer · GitHub](https://github.com/portainer/portainer/issues/3901)

IMO the only solution is to use a dedicated domain in the `router` rule.

---

_[View the full topic](https://community.traefik.io/t/all-subdirectories-return-404/9108)._
