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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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