-1

Say I have a website at /var/www/Electrician and I have a website at /var/www/Restaurant

If these websites use separate host files can I use the same CSS to reduce space?

If I am not mistaken I would certainly be unable to do ../../css/style.css because the one host is restricted from access the other, I would imagine.

I can see putting the one website into the other website directory, but I see that leaving room for cross-site issues.

I will admit I am doing a poor job explaining this. Essentially I would like to share CSS stylesheets between to separate websites on the same server, which will employ separate host files.

Sven
  • 97,248
  • 13
  • 177
  • 225
The Dude man
  • 155
  • 7
  • Perhaps this should be asked at http://webmasters.stackexchange.com/ – Colt Aug 24 '16 at 11:28
  • 3
    Sharing CSS files to *save space*? There are a lot of potentially good reasons to share CSS files, but "saving space" most likely isn't one. That said, there are *many* ways this can be accomplished, from symlinks to `` statements. However, if you want to save resources, it will be more effective if you share them one level up, e.g. you refer to CSS files on `http://example.com` on your secondary site `http://example.org` - this way the browser can use cached copies for users of both sites. – Sven Aug 24 '16 at 11:37

1 Answers1

1

Simple symlinking could do the trick, for example: /var/www/Electrician/css-stuff -> ../shared-css /var/www/Restaurant/css-stuff -> ../shared-css Make sure Apache or whatever is allowed to follow symlinks.

Vladimir
  • 321
  • 1
  • 12
  • Oh boy, I should have put more thought into this. I totally overlooked the use of a symbolic link for this. I didn't even think of using the full URL to link to the CSS of the other site. I appreciate your answer very much, thank you! – The Dude man Aug 25 '16 at 22:25