Making subdomains that point to their own folder

Im looking for a step by step solution as I wasnt able to find one that worked whilst googling

This is what I want to achieve, you have which loads its own webpages through folder var/www/example
Now I want a subdomain, to load its webpages through the folder /var/www/example/user

I would really appreciate a step by step for this or any other ways to achieve subdomains that illustrate different content in comparison to their parent domain.