I've recently got into doing a bit of web development and got hosting for it.
The website is consisted of mainly 3 separate folders(one for home page, 2 for 2subdomains) under the html root directory to avoid cluttering.
To get to my home page on my main domain, I used to do a redirect via a html meta refresh, so i would have an index.html file under the root directory which then redirects into the 'homePage' folder. I have since learnt that this is ugly and not a recommended way to do so.
At the moment I have a ".htaccess" file under the main directory with the following line inside.
Redirect 301 /index.html http://www.mydomain.com/homepagefolder
This works very well when I type in "www.mydomain.com", it will just redirect the client to "www.mydomain.com/homepagefolder". But when I tried to access a subdomain (e.g. "subdomain.mydomain.com"). The client would also get redirected to "www.mydomain.com/homepagefolder".
I would like to know the correct way of doing the redirecting, or if there is a better way to achieve what I'm trying to do. I'm very new to web hosting and web development so any help is appreciated!