# Multiple PathPrefix entries within one rule for one router

**URL:** <https://community.traefik.io/t/multiple-pathprefix-entries-within-one-rule-for-one-router/23170>\
**Category:** Traefik v3 (latest)\
**Tags:** docker\
**Created:** [June 13, 2024, 7:42pm UTC](https://community.traefik.io/t/multiple-pathprefix-entries-within-one-rule-for-one-router/23170 "2024-06-13T19:42:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xabix](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/xabix/32/8888_2.png) [@xabix](https://community.traefik.io/u/xabix)\
**Post date:** [June 13, 2024, 7:42pm UTC](https://community.traefik.io/t/multiple-pathprefix-entries-within-one-rule-for-one-router/23170/1 "2024-06-13T19:42:33Z")

</div>

Hello Team,

I am trying to find the right syntax to have many PathPrefix without repeating the Host entry.

Any advise? I read the [doc](https://doc.traefik.io/traefik/routing/routers/) but don't find is && and || can be used that way.

Merci

```auto
rule: "Host(`xxx.{{env "DOMAINNAME_CLOUD_SERVER"}}`) && ( 
        PathPrefix('/core/api/jeeApi.php(.*)$') ||
        PathPrefix('/data/(3d|backgrounds|fonts|img|object|plan|scenario|view)/(.*)$') ||
        PathPrefix('/plugins/JeedomConnect/core/api/JeedomConnect.api.php(.*)$') ||
        PathPrefix('/plugins/JeedomConnect/core/php/eventServer.php(.*)$') ||
        PathPrefix('/plugins/googlecast/tmp/(.*).mp3$') ||
        PathPrefix('/plugins/gsh/core/php/jeeGsh.php$') ||
        PathPrefix('/here.html$')
        )"

```

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 14, 2024, 5:13am UTC](https://community.traefik.io/t/multiple-pathprefix-entries-within-one-rule-for-one-router/23170/2 "2024-06-14T05:13:00Z")

</div>

> For exact matches, use `Path` and its prefixed alternative `PathPrefix` , for regexp matches, use `PathRegexp` .

[Doc](https://doc.traefik.io/traefik/routing/routers/#path-pathprefix-and-pathregexp)

---

<div class="post-metadata">

**Author:** ![xabix](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/xabix/32/8888_2.png) [@xabix](https://community.traefik.io/u/xabix)\
**Post date:** [June 14, 2024, 6:37am UTC](https://community.traefik.io/t/multiple-pathprefix-entries-within-one-rule-for-one-router/23170/3 "2024-06-14T06:37:57Z")

</div>

Thanks @bluepuma77 I will try that. As it was written alternative, I thought that I could just go with PathPrefix.

Merci! I ll report the outcome for the benefits of everyone then (hopefully working one :D)

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 14, 2024, 6:47am UTC](https://community.traefik.io/t/multiple-pathprefix-entries-within-one-rule-for-one-router/23170/4 "2024-06-14T06:47:04Z")

</div>

> [@bluepuma77](#):
>
> for regexp matches, use `PathRegexp` .

It might have changed with v3.

---

<div class="post-metadata">

**Author:** ![xabix](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/xabix/32/8888_2.png) [@xabix](https://community.traefik.io/u/xabix)\
**Post date:** [June 14, 2024, 6:54am UTC](https://community.traefik.io/t/multiple-pathprefix-entries-within-one-rule-for-one-router/23170/5 "2024-06-14T06:54:51Z")

</div>

Ok so my issue was not with Path or PathPrefix but with ' versus `

Now it works with:

> ```
> rule: "Host(`jeedom.{{env "DOMAINNAME_CLOUD_SERVER"}}`) && ( Path(`/core/api/jeeApi.php(.*)$`) ||
> PathPrefix(`/data/(3d|backgrounds|fonts|img|object|plan|scenario|view)/(.*)$`) ||
> PathPrefix(`/plugins/JeedomConnect/core/api/JeedomConnect.api.php(.*)$`) ||
> PathPrefix(`/plugins/JeedomConnect/core/php/eventServer.php(.*)$`) ||
> PathPrefix(`/plugins/googlecast/tmp/(.*).mp3$`) ||
> PathPrefix(`/plugins/gsh/core/php/jeeGsh.php$`) ||
> PathPrefix(`/here.html$`)
> )"
> 
> ```

Merci

---

<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:** [June 17, 2024, 6:55am UTC](https://community.traefik.io/t/multiple-pathprefix-entries-within-one-rule-for-one-router/23170/6 "2024-06-17T06:55:25Z")

</div>

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