# Path under subdirectory returns 404

**URL:** <https://community.traefik.io/t/path-under-subdirectory-returns-404/4350>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [February 11, 2020, 3:20pm UTC](https://community.traefik.io/t/path-under-subdirectory-returns-404/4350 "2020-02-11T15:20:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtucker502](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@mtucker502](https://community.traefik.io/u/mtucker502)\
**Post date:** [February 11, 2020, 3:20pm UTC](https://community.traefik.io/t/path-under-subdirectory-returns-404/4350/1 "2020-02-11T15:20:49Z")

</div>

I'm having an issue with subdirectories. I've removed all middlewares to show the issue I'm having.

Note: Because I have removed the stripprefix I full expect for the service (backend) to respond with a 404 since it is listening for "/".

```yaml

  phpmyadmin:

    image: phpmyadmin/phpmyadmin

    networks:

      - sql

      - traefik_public

    restart: on-failure

    environment:

      - PMA_ABSOLUTE_URI=https://test.example.com/phpmyadmin

    labels:

      - "traefik.enable=true"

      - "traefik.http.routers.phpmyadmin.rule=Host(`test.example.com`) && Path(`/phpmyadmin`)"

      - "traefik.http.routers.phpmyadmin.entrypoints=websecure"

      - "traefik.http.routers.phpmyadmin.tls=true"

```

If I request a page that matches the router rule exactly things work as expected:

```bash

mtucker502@myserver:$ curl -k https://test.example.com/phpmyadmin

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>404 Not Found</title>

</head><body>

<h1>Not Found</h1>

<p>The requested URL was not found on this server.</p>

<hr>

<address>Apache/2.4.38 (Debian) Server at test.example.com Port 80</address>

</body></html>

```

I also see that my service is receiving and responding to this request:

```bash

mtucker502@myserver:$ docker logs mariadb_phpmyadmin_1 --since 1m

172.21.0.3 - - [11/Feb/2020:14:57:52 +0000] "GET /phpmyadmin HTTP/1.1" 404 437 "-" "curl/7.58.0"

```

However if I request any page deeper in the router traefik sends a 404 and never forwards the request to my service:

```bash

mtucker502@myserver:$ curl -k https://test.example.com/phpmyadmin/test

404 page not found

mtucker502@myserver:$ docker logs mariadb_phpmyadmin_1 --since 1m

```

Here are the relevant traefik logs:

```auto

10.76.69.113 - - [11/Feb/2020:14:57:52 +0000] "GET /phpmyadmin HTTP/2.0" 404 276 "-" "-" 1056 "phpmyadmin@docker" "http://172.21.0.4:80" 1ms

time="2020-02-11T14:58:06Z" level=debug msg="Serving default certificate for request: \"test.example.com\""

10.76.69.113 - - [11/Feb/2020:14:58:06 +0000] "GET /phpmyadmin/test HTTP/2.0" 404 19 "-" "-" 1057 - - 0ms

```

Is this a misconfiguration on my end? How can I have the rule match phpmyadmin and all requests under phpmyadmin?

---

<div class="post-metadata">

**Author:** ![mtucker502](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@mtucker502](https://community.traefik.io/u/mtucker502)\
**Post date:** [February 11, 2020, 5:11pm UTC](https://community.traefik.io/t/path-under-subdirectory-returns-404/4350/3 "2020-02-11T17:11:41Z")

</div>

I have now learned the difference between Path and PathPrefix :).

---

<div class="post-metadata">

**Author:** ![LiamKarlMitchell](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/liamkarlmitchell/32/2188_2.png) [@LiamKarlMitchell](https://community.traefik.io/u/LiamKarlMitchell)\
**Post date:** [June 12, 2020, 8:27am UTC](https://community.traefik.io/t/path-under-subdirectory-returns-404/4350/4 "2020-06-12T08:27:58Z")

</div>

Hi @mtucker502,

Trying to get phpmyadmin on a subfolder path as well.  
Would you be able to explain Path/PathPrefix difference and how you pulled it off?

---

<div class="post-metadata">

**Author:** ![sachan007](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/sachan007/32/6655_2.png) [@sachan007](https://community.traefik.io/u/sachan007)\
**Post date:** [February 14, 2023, 3:03pm UTC](https://community.traefik.io/t/path-under-subdirectory-returns-404/4350/5 "2023-02-14T15:03:16Z")

</div>

```
  - "traefik.http.routers.http-admin.rule=Host(`${your_HOSTNAME}`) && PathPrefix(`/phpmyadmin`)"
  - "traefik.http.routers.http-admin.middlewares=admin-stripprefix,phpmyadmin"
  - "traefik.http.middlewares.admin-stripprefix.stripprefix.prefixes=/phpmyadmin"

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [February 17, 2023, 3:03pm UTC](https://community.traefik.io/t/path-under-subdirectory-returns-404/4350/6 "2023-02-17T15:03:57Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
