Map a folder to another directory/site

Not sure I am asking the right question, but what I need to do is map/link to a folder and share the content with other sites on the server.

Example:
Files to access are located here:
/public_html/domain.com/content/siteadmin/features/folder_to_access/
 I would like to access the content from:
www.anotherdomain.com/folder_to_access/ (domain is licated "/public_html/anotherdomain.com")

I would prefer to do this from code and no use either symlink or .htaccess
because, in my opinion, it will be easier to find and modify later down the road if/when I need to make changes.

Any suggestions would be greatly appreciated.
Jeff
JeffAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Salah Eddine ELMRABETConnect With a Mentor Technical Lead Manager (Owner)Commented:
Hi Jeff,

you can use referrer to redirect the request to the maped folder.

You can find out some use case in the following link http://www.phpjabbers.com/redirect-based-on-referrer-or-ip-address-php2.html

If it's not matching your need, make google search using referrer I beleive you can find other examples.

Best regards.

Salah
0
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
What are you doing with the files in that folder?
0
 
JeffAuthor Commented:
They don't necessarily need to be in that specific folder. They just need to be shared by all the sites and that is just the folder I put them in.

The folder is whare my admin files are and it is shared with a symlink. I would prefer not using a symlink because I would have to go back and link each site that needs access to the files.

Thanks Salah, I will take a look.
0
 
Ray PaseurConnect With a Mentor Commented:
I am guessing this is the output from getcwd()
/public_html/domain.com/content/siteadmin/features/folder_to_access/

If you are in control of both of domain.com and anotherdomain.com, you might see this from anotherdomain.com getcwd()
/public_html/anotherdomain.com/content/siteadmin/features/folder_to_access/

Looking at these two paths, I see that they diverge below public_html, so my sense is that if you want to share things between the two sites you would want to put a subdirectory into public_html and place the shared items there.  A properly configured web server would not let two domains share data from directories below the URL.  However you might be able to share a data base.
0
 
Slick812Connect With a Mentor Commented:
I fail to understand what you might mean by  "I would prefer to do this from code" and you give an example of -
www.anotherdomain.com/folder_to_access/

if you want to get a file to a browser by
www.anotherdomain.com/folder_to_access/income.php

then I do not see where any PHP code would be practacle, and your alternatives such as .htaccess, have already been mentioned in other comments here, ,

however if you mean to access the other directory file by -
www.anotherdomain.com/folder_to_access/?fl=income.php

then you might be able to use PHP code
0
All Courses

From novice to tech pro — start learning today.