htdocs is usually usually the document root for your main domain
example.com. I'm assuming that you mis-typed your example and that it is actually
example.com/sd that gives you the same result as the subdomain. It is not advisable to create sub-directories of that to house sub-domains. Instead you should use a completely different document root. For example I create directories like this on my server for various document roots:
That way none of the sub-domains are nested within another domain. Everything just works better.
Unfortunately on shared hosting, you may not have the luxury of managing your directory structure and document roots carefully. The shared hosting interface cPanel has a bad habit of hosting the main domain in a directory and creating sub-directories for sub-domains and add-on domains. In that case you have to put code in the
.htaccess of the main domain to prevent sub-directory access.
Redirect permanent /sd/ http://sd.example.com/
Redirect permanent /sd http://sd.example.com/