View Full Version : ADDON domain not recognising linked scripts/images
Blaice
09-30-2008, 09:16 PM
Hey guys I've been absolutely trawling the **** out of google looking for answers to what seems to be a very basic problem. I've recently registered a domain and assigned it as an addon under my main domain. I let it go for a couple of days until the DNS was done propagating before I started uploading html and css scripts as well as a few images to play around with.
While the website shows up fine (and I can change a few simple things in html) it just will not recognise my css script or any of the images I’ve linked. At first I thought it was just incorrect typing of links and css code so I tried checking everything in my main domain and the result was perfect. As soon as I upload all of this back into my addon directory however, nothing shows up at all - apart from say the website title and a few paragraph tags.
I’ve talked to a lot of mates who have addon domains and they’ve all said that the process is simple/easy but I just can’t get past this. It’s probably a really simple problem so please shed some light on this nub!
Regards
areidmtm
09-30-2008, 09:59 PM
What is the URL?
Blaice
09-30-2008, 10:27 PM
Addon domain is ventrage.com
Main domain is biosphereproject.com
wysiwyg
09-30-2008, 11:00 PM
File is linking to "/ventrage/index.css", should be linking to "/index.css". Alternatively, move your files into a folder called "ventrage".
Blaice
09-30-2008, 11:09 PM
Yeah they're already in a folder called ventrage.
"/index.css" indicates the script of my primary domain.
"/ventrage/index.css" indicates the script of my addon domain which is located within a subfolder of my primary directory (created automatically when bluehost assigned the domain to addon).
felgall
09-30-2008, 11:52 PM
"/ventrage/index.css" indicates the script of my addon domain which is located within a subfolder of my primary directory (created automatically when bluehost assigned the domain to addon).
No it doesn't. That indicates a script in that folder used by the main domain. The main domain's root folder is index_html. The add-on domain's root folder is public_html/ventrage. If you reference /ventrage/index.css from the add-on domain it is looking for public_html/ventrage/ventrage/script.css because it starts from the add-on domain's root folder for its search.
wysiwyg
10-01-2008, 12:06 AM
Alright, here we go.
Browsers look for files with relative paths in relation to the current URL.
A path beginning with a forward slash tells the browser to set the pointer directly after the domain name itself. For example, /ventrage/ from biosphereproject.com points to biosphereproject.com/ventrage/ (http://biosphereproject.com/ventrage/).
Simple, right?
Taking the same relative path and moving it to a page on ventrage.com translates into ventrage.com/ventrage/ (http://ventrage.com/ventrage/). Now we have a problem. This folder doesn't exist.
What's the solution?
Depends on how much effort you want to put into it.
You could change the URLs so that the browser looks for files relative to the current directory instead of the domain (don't forget the one in the css file). This is done by placing a period before the forward slash (./index.css vs /ventrage/index.css).
You could keep the paths relative to the domain, except removing the "/ventrage" portion (/index.css), which would make it work on ventrage.com but not on biosphereproject.com/ventrage.
Or you could just move the files into a folder called "ventrage" under your addon domain's root folder. This would of course also break links on biosphereproject.com/ventrage.
It's up to you what you want to do to fix it.
Blaice
10-01-2008, 12:50 AM
Thanks a bunch Fel and especially Wys. Yeah I don't want any affiliation between bioproj and vent so I just used the period to point to the relative directory and bam it worked straight up!
You guys explained the process perfectly and I thank you both for that - it makese utter sense I'm just having trouble grasping some aspects since i'm incredibly new to web building.
BTW how common is period usage?
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.