View Full Version : Why is Subdomain effecting html/css code?

07-16-2008, 12:34 AM
Hi there,

Im trying to set up a sub domain. i have created a page with its own folder and it works fine for me offline then when i access it online the images will not display.

stranger again if i access it http://www.galwayartworks.com/store/winnie/ the page is fine

the subdomain with the problem is http://winnie.galwayartworks.com/

how can the same html page in the same folder act different cause its accessing from a different place?

i have tried lots of messing around with the code and this is my last resort

Thanks for any help or comments in advance.


07-16-2008, 12:45 AM
Is the css in a seperate .css file or all determined in the <head> </head> tags?

07-16-2008, 12:50 AM
there is some in the head and some in a separate file.

this is one of the images that is not displaying

<td style="background-image:URL(d/header_bg.gif); background-repeat:repeat-x;" bgcolor="#52B6DE">

Thanks for reply

07-16-2008, 12:56 AM
Make sure you copy the .css file to the same directory in the subdomain.

07-16-2008, 01:03 AM
The sub domain will affect how relative links work. The sub domain is considered a separate site so the root of the sub domain will be /.

07-16-2008, 01:10 AM
Wow thanks oracleguy that solved my problem straight away. what a great forum only came across it tonight. was thinking i might get an answer tomorrow if im lucky!! thanks rafiki for your response too.

Thanks again guys

07-16-2008, 01:11 AM
The sub domain will affect how relative links work. The sub domain is considered a separate site so the root of the sub domain will be /.


07-16-2008, 07:14 PM
Im back, i changed the code so the files are linked to directly and it seemed to work for me last night.

<td style="background-image:URL(http://www.galwayartworks.com/store/winnie/d/header_bg.gif); background-repeat:repeat-x;" bgcolor="#52B6DE">

But when i went back to it today its not showing the images?

Im so confused how can it work it when you go to the page location without the subdomain


and then when you go to it this way it shows you the page but the images will not load.


Is it bad code im using i just cant understand it.

Thanks again for helping me.


08-26-2008, 11:53 PM
There's something funny about subdomains and css/images that nobody seems to have touched on yet. I've never been able to get any css code to work from an external stylesheet in a url which is on a subdomain, despite the fact the link in the html header is valid (entering it as the URL just downloads the stylesheet). And moving the same code to the main site works fine.

I would be grateful if anyone has any thoughts, and I will keep this forum in my bookmarks for when I solve this problem, because I have a feeling it is related to what lukeee is describing here.

I am hosted on a Ubuntu Apache server hosted by 1and1.

08-27-2008, 12:11 AM
Silly me! Please ignore my last post. The problem I was having was because the images URLS in the css were on higher levels of the directory than the root of the subdomain (which was one folder in from the actual www root and of course it couldn't access it. Even though the css file url was still correct relative to the root of the subdomain.

The other problems I've been having from other software I installed were caused by the same problem, absolute links which (of course) are now different.