Forum Moderators: not2easy

Message Too Old, No Replies

Sharing stylesheets amongst different domains

...but on the same physical server

         

coopster

9:13 pm on Dec 14, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Does anybody manage multiple sites which share a common stylesheet? For example, let's say we have the following domains...
example1.com 
example2.com
example3.com
...and all share a common layout so we would like to create and use a single, common stylesheet file. The trick is that we want to have one and only one file, not duplicates spread across different domain directory structures.

I realize there are a number of options here, such as having the files refer to a single site source file -- for example, have the

.htm
files on example2.com and example3.com use an
@import url("http://example1.com/css/common.css");
which refers us to the example1.com domain, but we really don't want to take that route, and feel we shouldn't have to since the domains are all hosted on the same server.

Rather than duplicate the

common.css
file, how do you handle the situation?

Longhaired Genius

9:38 pm on Dec 14, 2004 (gmt 0)

10+ Year Member



I dont know why you don't want to take "that route" (that's exactly what I do). I think "all the domains on the same server", is a bit of a red herring. A domain is a domain, the whole point of having a "virtual domain" is to make it seem separate from other domains on the same machine.

Guilt_Puppy

10:33 pm on Dec 14, 2004 (gmt 0)

10+ Year Member



Rather than give an under-educated response, I'll just point out that this is not a CSS problem -- you'll have much better luck finding an answer in one of the Webmaster-side forums... Depending on your operating system and server software, there are a few different ways of doing this (none of which I could explain personally), but they're all server-side solutions, which have nothing in the world to do with CSS.

Lance

1:58 am on Dec 15, 2004 (gmt 0)

10+ Year Member



It is server side, but I'll take a quick stab at it...

Put all your stylesheets in a folder, anywhere you like. Could be under example1.com's root, or as a sibling to all three domains.

Assuming IIS, in the admin tool, go to each domain and create a New -> Virtual Directory. Name it something creative like "Styles" and point it to the physical folder you created (above). If in the step above you put the folder under example1.com, then you do not need to do this for example1.com.

Now just make sure alll your pages look for "/Styles/someSheet.css".

coopster

2:29 am on Dec 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




I think "all the domains on the same server", is a bit of a red herring.

Off topic, but I'll offer an explanation. One company owns and operates all of the domains and have opted to do so on their own server. The company chooses to own and operate a single server to minimize maintenance and management costs. There is a mirrored backup for disaster recovery, of course. Apache's virtual hosts option is a perfect fit for this type of setup, and indeed part of the Apache developers intentions/design.


which have nothing in the world to do with CSS

Welcome to WebmasterWorld, Guilt_Puppy.

I humbly disagree. If you have ever faced this type of problem and are developing for a similar situation I think you will quickly realize that other developers have probably faced this more often than expected and if they haven't worked it out on their own, they have probably brainstormed a solution with other folks in their enviroment, possibly system administrators or otherwise. That's the folks I'm hoping will spot this thread and contribute ;)

Lance,

This is an option that another respected peer has suggested (except it's a symlink on a *nix server running Apache). I think this is going to be the best route as well but wanted to get feedback from the community.