# Exclude a PathPrefix

**URL:** <https://community.traefik.io/t/exclude-a-pathprefix/7192>\
**Category:** Traefik v2\
**Tags:** docker, docker-swarm\
**Created:** [August 5, 2020, 10:21am UTC](https://community.traefik.io/t/exclude-a-pathprefix/7192 "2020-08-05T10:21:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![smcardle](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@smcardle](https://community.traefik.io/u/smcardle)\
**Post date:** [August 5, 2020, 10:21am UTC](https://community.traefik.io/t/exclude-a-pathprefix/7192/1 "2020-08-05T10:21:07Z")

</div>

Hi.

Can somebody tell me how to exclude a PathPrefix from the Host rule.

I have a service deployed that should have ALL paths accessible EXCEPT any path beginning with /data/ as a PathPrefix.

It seems only possible to join Host and PathPrefix rules using && or || but I cannot see a way to EXCLUDE. Something like  
Host('subdomain.domain.tld') && !PathPrefix('/data/')

Regards

---

<div class="post-metadata">

**Author:** ![smcardle](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@smcardle](https://community.traefik.io/u/smcardle)\
**Post date:** [August 8, 2020, 1:08am UTC](https://community.traefik.io/t/exclude-a-pathprefix/7192/2 "2020-08-08T01:08:47Z")

</div>

Does nobody have any idea how to exclude a PathPrefix from a Host rule ???

---

<div class="post-metadata">

**Author:** ![Arteom\_Parfenenko](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/arteom_parfenenko/32/2893_2.png) [@Arteom\_Parfenenko](https://community.traefik.io/u/Arteom_Parfenenko)\
**Post date:** [November 21, 2020, 2:58pm UTC](https://community.traefik.io/t/exclude-a-pathprefix/7192/3 "2020-11-21T14:58:33Z")

</div>

try it PathPrefixStrip: ?

---

<div class="post-metadata">

**Author:** ![diegodevops](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/diegodevops/32/3677_2.png) [@diegodevops](https://community.traefik.io/u/diegodevops)\
**Post date:** [January 7, 2021, 12:44pm UTC](https://community.traefik.io/t/exclude-a-pathprefix/7192/4 "2021-01-07T12:44:51Z")

</div>

> [@Arteom\_Parfenenko](#):
>
> PathPrefixStrip

I am afraid you have to play with regular expressions of goland

> **[regexp package - regexp - Go Packages](https://pkg.go.dev/regexp)**
>
> Package regexp implements regular expression search.

---

<div class="post-metadata">

**Author:** ![diegodevops](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/diegodevops/32/3677_2.png) [@diegodevops](https://community.traefik.io/u/diegodevops)\
**Post date:** [January 7, 2021, 12:45pm UTC](https://community.traefik.io/t/exclude-a-pathprefix/7192/5 "2021-01-07T12:45:44Z")

</div>

Which version of traefik accepts PathPrefixStrip?  
I havent found it on the whole official documentation

Diego
