Where do I put files in subdomains?

Ok, so I’ve done a bunch of searching so far for this answer, and just can’t really find one that’s clear.

I’m coding my mobile site, just got done with the regular site. I want to direct people to a subdomain to view the site on their phone, e.g. http://m.examplesite.com or like http://m.cnn.com

I’ve setup the subdomain on godaddy (pretty sure - added a subdomain, and a C-Name record for it.

Where do I put the html files for this subdomain on my site? If someone goes to http://m.examplesite.com, do they view files in the /m folder? If so, what do I name my html files? Do I put an index.html file in that /m folder?

If possible, I like to not include any php or javascript to achieve this. And, I’d also not like to redirect people to something like http://www.examplesite.com/m

What’s the standard way of doing this?

Any help would be great.
(first post on here btw - bought a sitepoint css book, it’s been great)


Usually with most control panels, you create a subdomain, you should be able to pick the folder you want to be as the root of your subdomain.

I’m not too familiar with GoDaddy’s hosting interface. (I’m assuming you get your hosting there.) I would suggest emailing their support for assistance.

Technically you can specify any folder for a subdomain, but for obvious reasons, I recommend placing the “root” folder for the subdirectory directly into your website’s root folder; then give the folder the same name as the subdomain, so in this case “m”.

I agree with Tin. Setting up your subdomain and C record means that the subdomain now “exists” and people who try to pull it up will be directed to your webhosting account. Now you just need to use the control panel to tell the account which folder to look in, I bet the Control Panel will let you do this pretty easily once you find the right menu or tab. If not, the FAQs and / or support can point you in the right direction.

when you create a sub-domain the hosting server should automatically create a folder named after the sub-domain. Check your public_html directory or wherever your files are stored on your host.

If not then I would make a folder named after the sub-domain and point it to that folder. There should be an option to do that if your using Cpanel interface.

Your question appears to be answered for the most part. I did have this to add, though: if you are trying to do a mobile site, many people will just use a different css file, rather than a completely different set of files for the site.