Map a folder to another directory/site

Posted on 2011-10-13
Last Modified: 2012-05-12
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.
Question by:jeffey48
    LVL 8

    Accepted Solution

    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.

    LVL 82

    Assisted Solution

    by:Dave Baldwin
    What are you doing with the files in that folder?

    Author Comment

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

    Assisted Solution

    by:Ray Paseur
    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.
    LVL 33

    Assisted Solution

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now