The following files show an example of how to create subdomains for onion site hidden services. (This hasn't been tested for hidden services for anything other than HTTP/HTTPS.)
(You might also want to read our blog post about ProPublica’s Tor hidden service, including a tutorial and notes on running a hidden service: https://www.propublica.org/nerds/item/a-more-secure-and-anonymous-propublica-using-tor-hidden-services )
In general, this works (maybe just in recent Tor clients) because Tor will handle
the connection to www.xxxxxxxxxxxxxxxx.onion
as a connection to
xxxxxxxxxxxxxxxx.onion.
The encapsulated HTTP/HTTPS connection contains the
subdomain in the Host:
header (and in the case of HTTPS, the SNI
part of the TLS handshake), so the underlying web server knows what domain
the client actually wants.
Be aware that there might be some issues with older tor clients and tools (possibly things like torsocks) that have issues addressing subdomains like this (since they don't resolve the subdomain as a connection to the root onion domain).
thats great thank u