Page 1 of 1

files outside document root

Posted: Mon Mar 12, 2012 4:22 pm
by rhecker
I have websites with the following directory structure:

public_html/site1
/site2
/css
data_access

In the above scenario, the domain name site1.com points to /site1 and site2.com points to /site2

PHP can access the files outside the document root with a path like "../../data_access/file.php

. . .but I need to share CSS files and other files outside the document roots, and HTML doesn't allow this.

The server is a VPS, so I have a lot of control, and I'm sure there is a way, but I don't know what it is.

Meanwhile, I am researching various options. Security is a serious concern. It looks like symlink might create a vulnerability.
Any help?

Re: files outside document root

Posted: Mon Mar 12, 2012 6:10 pm
by Christopher
Use symbolic links:

ln -s /path/to/public_html/site1/css /path/to/public_html/site2/css

Re: files outside document root

Posted: Tue Mar 13, 2012 3:04 pm
by rhecker
Thanks Christopher. I ended up using Alias, which works on the VPS but just won't work on my windows 7 machine. This is what I have.

<IfModule alias_module>
Alias /css_shared "D:/Apache2/htdocs/site/css"
</IfModule>
<Directory "D:/Apache2/htdocs/site/css">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>