My webserver file system is equivalent to the following:
/master-domain.tld /master-domain.tld/assets/js/foo.js /master-domain.tld/assets/css/bar.css /sub1.master-domain.tld /sub1.master-domain.tld/assets/js/foo.js /sub2.master-domain.tld /sub1.master-domain.tld/assets/css/bar.css ...
What I would like to know is how to maintain my common static assets (hosted in the main domain) for my subdomains - the reason is that I only need to maintain one set of βcoreβ assets then, and not update / copy any files to all other subdomains every time I edit them. Obviously this can be achieved using absolute URLs, but my goal is to avoid them, so that my local / dev system does not need any remote calls during development / debugging.
I currently have a mod_rewrite + symlink + php script configured for each subdomain, linking any calls with non-existent local assets to the main assets. for example, calling "/sub1.master-domain.tld/assets/css/bar.css" will retrieve the bar.css file hosted in the main domain because the local version of bar.css does not exist. In addition, calling "/sub1.master-domain.tld/assets/js/foo.js" will serve the local version of foo.js as it exists.
But my current method seems to interfere with the loading performance of my page, and I wonder if there is a more efficient (still modular) approach to solving this problem.
Any tips? Am I really not quite right about this?
source share