Yes, this is the default behavior. The web server should be configured to serve from the correct document root when the request comes from a specific subdomain.
For example, if you use apache, you should configure virtual hosts appropriately.
Above page contains the below example:
# Ensure that ...