# How do I setup acls to split a server by directory

**URL:** <https://discourse.haproxy.org/t/how-do-i-setup-acls-to-split-a-server-by-directory/2608>\
**Category:** Help!\
**Created:** [June 12, 2018, 11:50pm UTC](https://discourse.haproxy.org/t/how-do-i-setup-acls-to-split-a-server-by-directory/2608 "2018-06-12T23:50:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbrahy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/jbrahy/32/525_2.png) [@jbrahy](https://discourse.haproxy.org/u/jbrahy)\
**Post date:** [June 12, 2018, 11:50pm UTC](https://discourse.haproxy.org/t/how-do-i-setup-acls-to-split-a-server-by-directory/2608/1 "2018-06-12T23:50:29Z")

</div>

I still have a lot to learn with HA Proxy. I know it’s done through acls but I’m not sure how to do it properly. Can someone show me the right way to make all of the server urls except one go to the default server and the /other url to another server? Thanks in advance!

```
global
    log 127.0.0.1 local2 debug
    chroot /var/lib/haproxy
    pidfile /var/run/haproxy.pid
    maxconn 4000
    user haproxy
    group haproxy
    daemon
    stats socket /var/lib/haproxy/stats
    tune.ssl.default-dh-param 1024

defaults
    mode http
    option httplog
    log global
    option dontlognull
    option http-server-close
    option redispatch
    retries 3
    timeout http-request 10s
    timeout queue 1m
    timeout connect 10s
    timeout client 1m
    timeout server 1m
    timeout http-keep-alive 10s
    timeout check 10s
    maxconn 3000

frontend frontend-http
    bind 1.2.3.4:80
    default_backend backend-http

backend backend-http
    option forwardfor
    server web-1 www.website1.com:80 check

frontend frontend-https
    bind 1.2.3.4:443 ssl crt /etc/haproxy/ssl/default.pem crt /etc/haproxy/ssl
    default_backend backend-https

backend backend-https
    option forwardfor
    server web-1 www.website1.com:443 check ssl verify none
```

---

<div class="post-metadata">

**Author:** ![arash](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/arash/32/255_2.png) [@arash](https://discourse.haproxy.org/u/arash)\
**Post date:** [June 13, 2018, 3:24am UTC](https://discourse.haproxy.org/t/how-do-i-setup-acls-to-split-a-server-by-directory/2608/2 "2018-06-13T03:24:01Z")

</div>

Hi

```
frontend frontend-http
    bind 1.2.3.4:80 
    acl foo path_beg -i /foo
    use_backend backend-foo if foo 
    default_backend backend-http

backend backend-foo
    option forwardfor
    server web-2 www.website1.com:80 check

```

if url begins with /foo it will use backend-foo , others will go to default backend

---

<div class="post-metadata">

**Author:** ![jbrahy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/jbrahy/32/525_2.png) [@jbrahy](https://discourse.haproxy.org/u/jbrahy)\
**Post date:** [June 13, 2018, 11:07pm UTC](https://discourse.haproxy.org/t/how-do-i-setup-acls-to-split-a-server-by-directory/2608/3 "2018-06-13T23:07:23Z")

</div>

Awesome, that was perfect. Thanks!
