Click to See Complete Forum and Search --> : need a bit of help with website structure
bobmurphy
08-25-2003, 02:37 PM
hi -- i need a bit of advice about how to sturcture my site -- i have a master css page that i want all pages to access; however i put all my pages in different folders and call them all index.html to allow users to ommit the .html suffix when they are surfing ... so the only way i have found of allowing all pages to access this master css page is to code in the full address ie. http://www.mysite.com/master.css ... which seems to work; however i want to write and edit the site using apache on my local machine and if i am online at the same time then the browser will fetch the internet address (above) instead of the one on my local m/c which i may be editing ... surely i am missing something .. surely there is a way to reference the master.css page that will work on both the internet aswell as on my local machine ???
hope i have explained myself correctly
thanks
bob
couchmonkey
08-25-2003, 03:31 PM
Relative URLs like ../master.css (looks in directory one level above) should work. I think you would write ../../master.css for a file two folders down from the root, but to be honest my file structures rarely go that deep so I'm not certain.
One more thing. I think that to be "compliant" with the latest w3c standards, you have to specify a base URL for any page that uses relative URLs...like this: <a base href="http://www.yoursite.com"> The problem is, this reverses the effect of the relative URLs and puts you right back to square one: your pages will always access the stylesheet on yoursite.com. Luckily, I don't know of any browsers that actually enforce this restriction, but it's worth keeping in mind that your html may not be strictly compliant if you use relative URLs and don't include the base URL.
spufi
08-25-2003, 04:07 PM
I use relative links to link to anything within my site and I don't use the base thing at all. I validate against XHTML 1.1 and I have no problems validating due to this issue.
bobmurphy
08-26-2003, 01:00 PM
i just discovered what i was doing wrong .... i was ommitting the intial / before the address ... ie its's meant to be ... /folder/master.css ... not ... folder/master.css
( IE6 )
thanks all
bob:D
couchmonkey
08-26-2003, 02:15 PM
Spufi: I'm not surprised that it works. My memory of the base href thing isn't so great, I may have it wrong, or it may be outdated or just so obscure that nobody uses it.