Jump to content

Sharing common files between sub-domains


Psycho

Recommended Posts

I'm going to try and explain this the best I can - I hope it is understandable.

 

I'm looking for some ideas and best practices for setting up my sub-domains to make sharing/including common files among different sub-domains easy. Specifically, I am looking for a solution that will make it easy to reference common files in the PHP script as well as referencing common images within the HTML. This is particularly a problem when including files in a PHP script that may include other files - can't use relative pathing.

 

For example, let's say I had this folder structure:

 

mydomain.com

|

|--sub1.mydomain.com

|

|--sub2.mydomain.com

|

|--images

|

|--includes

 

I could create a $prepath varaible with the value "..\" for the subdomains and "" for the main domain. Then use that to reference all files from the root of the main domain. Of course I would have to reference any images in the HTML with a full path from the main domain only.

 

Again, I hope this all makes sense. Anyone have some common practices or tricks that they use in these situations?

Link to comment
https://forums.phpfreaks.com/topic/66530-sharing-common-files-between-sub-domains/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.