Forum Moderators: phranque

Message Too Old, No Replies

Proper Set Up of Sub-Domains

         

Fortune Hunter

1:44 am on Jan 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a site I just finished that involves the use of some sub-domains. I have never had a site before that used them before and I was having some problems getting the pages set up.

The main site has a link to the sub-domain directories and when you went to the site using those links the pages looked fine. The link from the main pages to the sub-domain pages look like...

http://www.example.com/subdomain

Where the main page inside the sub-domain folder was called "index.htm"

However when you went directly to the sub-domain in the address bar as in...

http://subdomain.example.com

All the images would be screwed up, you couldn't see any of them. I tried scripting the pages to go one level up and look for the images folder, but it still wouldn't work if you went to the site this way.

I contacted the hosting company and they said that the only way it would work is if I put a copy of the images folder inside the sub-domain folder along with a copy of my navigation folder. Essentially I had to have an encapsulated version of my site in this sub-domain folder to make it work correctly.

I did this and it works fine, but I was wondering if anyone else that uses sub-domains knows if this is the standard way to set it up. It just seems redundant and a waste of server space to have my images and navigation folders copied multiple times (one time per sub-domain folder) plus once at the root level for the rest of the site pages to use.

[edited by: phranque at 1:54 am (utc) on Jan. 26, 2009]
[edit reason] exemplified urls [/edit]

bill

2:12 am on Jan 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



A subdomain is a separate domain regardless of the folder structure of the back end at your host. If you did an absolute reference to your images from the subdomain that should solve things: ex. http://example.com/images/001.gif

maximillianos

3:34 pm on Jan 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yup, subdomains are basically considered completely different domain names... Hence the reason you typically use a separate directory. Otherwise, why not just 301 to the main domain if you don't plan on using it as a separate site?

Fortune Hunter

7:51 pm on Jan 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you did an absolute reference to your images from the subdomain that should solve things: ex. http://example.com/images/001.gif

I thought about doing this, but decided I didn't really want to re-program all the image links. Maybe I will do that when I have more time. Both you answered my question about it being totally separate. Thanks!