-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.

2
  • Perhaps this should be asked at 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 <location> 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

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.

1
  • 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! Aug 25 '16 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.