How brave setup their onion sites for home and search(with subdomain)?

usually https://brave4u7jddbv7cyviptqjc7jusxh72uik7zt6adtckl5f4nwy2v72qd.onion/ would point to localhost:80
and https://search.brave4u7jddbv7cyviptqjc7jusxh72uik7zt6adtckl5f4nwy2v72qd.onion/ would point to localhost:XXXX some other port which will be running a web server program for search engine.
how does this redirection happens with subdomains in Tor onion site?