SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using one CSS file across many domains.

    Hey guys,

    Having a bit of a problem here.

    I have 2 sites that have the exact same layout and use the exact same CSS.

    so for this example lets use:

    domain1.com and domain2.com.

    Now, I have the a copy of the css file on each domain:

    domain1.com/css/style.css
    domain2.com/css/style.css

    and each site gets the css linked in the <head> section:

    <link rel="stylesheet" type="text/css" href="http://domain1.com/css/style.css" />
    <link rel="stylesheet" type="text/css" href="http://domain2.com/css/style.css" />

    So all is good so far and pretty self-explanatory.

    The problem comes when I make a change to the site. I always have to make sure that any changes I make for the domain1.com CSS need too be made again for domain2.com. It kind of gets annoying and basically makes me do double the work on every little change.

    I know I can simply link domain2.com to the css stored on domain1.com and have it like this on both domains:

    <link rel="stylesheet" type="text/css" href="http://domain1.com/css/style.css" />

    But I don't want domain2.com to be accessing information from domain1.com.

    I want to know if there is a way to do this server-side. Where I can have both domains grab the same CSS file and have it look like each domain actually has its own CSS.

    Man this was pretty hard to explain. I'm probably not wording it in the best possible way but I hope someone understands me

    thanks guys

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Make your changes once.
    Save the file.
    Save As to the other domain's site folder.
    Upload both.

    Problem? What Problem?

  3. #3
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by seven- View Post
    But I don't want domain2.com to be accessing information from domain1.com.
    Failing Dr. John's suggestion, is there any reason why you don't want domain2.com to be accessing the domain1.com stylesheet? If the stylesheet will always be identical then I don't see any problems with doing this.

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can only guess that the OP doesn't want someone who's viewing the source to know that the two sites are related.

    One solution would be to host the CSS on a third, "neutral," domain (or IP only) and have both sites link to that CSS.

    If that is indeed the reason and you want to go to that extreme, then you may want to ensure that the WHOIS/registration info for the "neutral" domain is also "neutral."

    John

  5. #5
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help rainmakr, you hit it right on the nail

    That's most likely what I will do.

    Quote Originally Posted by Dr John View Post
    Make your changes once.
    Save the file.
    Save As to the other domain's site folder.
    Upload both.

    Problem? What Problem?
    Hehe... well when you put it that way... I guess I'm just lazy then

    Thanks to all who replied,

    -seven


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •