Load js/css libraries from folder outside domain's folder

I’m not sure if this is possible but…

Normally you use the following for bringing in your CSS & JS files. The path either within the domain’s folders or you use a full url to pull the file in.
<script src=“/scripts/javascript.js” type=“text/javascript”></script>
<link rel=“stylesheet” type=“text/css” media=“all” href=“/style.css” />

or

<script src=“http://domain.com/scripts/javascript.js” type=“text/javascript”></script>
<link rel=“stylesheet” type=“text/css” media=“all” href=“http://domain.com/style.css” />

We are building a “web app” that will house all of it’s scripts in /home/webApp on our VPS server.
The html files for each client will be house in their own folder /home/1stClient/public_html, /home/2ndClient/public_html, /home/3rdClient/public_html, etc…

Our “web app” will have it’s own set of JS & CSS files that will remain in /home/webApp. Is there a way with PHP to link to those files? Or is there a better way to manage this?

I would suggest that you create a symbolic link (or two) in the client’s “public_html”, pointing to the directory containing the Javascript and CSS files. This should preferably be done automagically when deploying your source (I use Capistrano or Git hooks to do this stuff) but that’s entirely up to you.

So, when you deploy a client app to “/home/1stClient/public_html”, you can create a symbolic link from “/home/1stClient/public_html/js” pointing to “/home/webApp/js”, or wherever you have your Javascript files. The same goes for the CSS files/directory. It will work just as if the files were located within the client’s folder.

You do this by using the “ln -s” command in Linux.

The files to be downloaded to the browser all need to be in the web accessible folder on the server. The only way around that is to use a server side script located in the web accessible area that runs to retrieve the content from where ever it is really stored and to then deliver it to the browser.

Thank you both for the quick responses. I do appreciate it very much.
I will post back after I’ve tried these out.

@dnordstrom - I will check out Capistrano and Git hooks since I have nothing for this currently. Thanks.