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.

Files to access are located here:
 I would like to access the content from: (domain is licated "/public_html/")

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.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

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

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

Best regards.

Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
What are you doing with the files in that folder?
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.
Ray PaseurConnect With a Mentor Commented:
I am guessing this is the output from getcwd()

If you are in control of both of and, you might see this from getcwd()

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

if you want to get a file to a browser by

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 -

then you might be able to use PHP code
All Courses

From novice to tech pro — start learning today.