0

So my questions is as follows:

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

I appreciate you for taking the time for having read this, if you can provide assistance more praise is underway!

| improve this question | | | | |
  • Are you intending to directly link to this external stylesheet from the client-side HTML? Or dynamically pull the stylesheet from the other host server-side?? – MrWhite Aug 24 '16 at 13:14
2

Yes, but as you already guessed you wouldn't be able to use relative paths because that would take you outside of the web root. You you would need to use the full URL to the CSS file to reference it in a different site:

So instead of ../../css/style.css you would do http://example.com/css/style.css.

| improve this answer | | | | |
  • 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! – Evan Aug 25 '16 at 22:22

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.