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?
files outside document root
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: files outside document root
Use symbolic links:
ln -s /path/to/public_html/site1/css /path/to/public_html/site2/css
ln -s /path/to/public_html/site1/css /path/to/public_html/site2/css
(#10850)
Re: files outside document root
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>
<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>