# Mapping domains and subdomains

**URL:** <https://discourse.haproxy.org/t/mapping-domains-and-subdomains/7546>\
**Category:** Help!\
**Created:** [March 31, 2022, 8:35am UTC](https://discourse.haproxy.org/t/mapping-domains-and-subdomains/7546 "2022-03-31T08:35:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamzar1](https://avatars.discourse-cdn.com/v4/letter/k/5f8ce5/32.png) [@kamzar1](https://discourse.haproxy.org/u/kamzar1)\
**Post date:** [March 31, 2022, 8:35am UTC](https://discourse.haproxy.org/t/mapping-domains-and-subdomains/7546/1 "2022-03-31T08:35:07Z")

</div>

HA v. 2.4.12

**Frontend** :  
`use_backend %[hdr(host),lower,map_dom(/etc/haproxy/Maps/domains.map)]`

**domains.map** :

```auto
domain.com srv
sub1.domain.com srv1
sub2.domain.com srv3

```

Now, calling [anysub.domain.com](http://anysub.domain.com) only matches the first occurrence of map ‘[domain.com](http://domain.com)’  
What would be the right syntax for an exact match? `map_beg`, `map_end` or `map_str` ?

Also wonder, whether can point to multiple map files (due to better organization) at same front end?
