LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Symbolic Links, directories, and relative paths (../). Can it be done? (http://www.linuxquestions.org/questions/linux-newbie-8/symbolic-links-directories-and-relative-paths-can-it-be-done-299928/)

jimwillsher 03-10-2005 05:58 AM

Symbolic Links, directories, and relative paths (../). Can it be done?
 
CentOs 4.0 (basically RHEL4), running Apache. Home directory for apache documents is /var/www/html/

I have 6 websites on my server, and all have a common "Latest news..." script which lives in a folder called News.

At present I have the following folders (representative):

/var/www/html/website1/News/
/var/www/html/website1/News/DisplayNews.php
/var/www/html/website1/News/Admin
/var/www/html/website1/News/Admin/MaintainNews.php
/var/www/html/website1/News/Config
/var/www/html/website1/News/Config/Config.php

/var/www/html/website2/News/
/var/www/html/website2/News/DisplayNews.php
/var/www/html/website2/News/Admin
/var/www/html/website2/News/Admin/MaintainNews.php
/var/www/html/website2/News/Config
/var/www/html/website2/News/Config/Config.php

/var/www/html/website3/News/
/var/www/html/website3/News/DisplayNews.php
/var/www/html/website3/News/Admin
/var/www/html/website3/News/Admin/MaintainNews.php
/var/www/html/website3/News/Config
/var/www/html/website3/News/Config/Config.php

etc.

Now, it would be very efficent if I could move the /News folder to a common place, e.g. /var/www/html/News

and create links to the /News and /News/Admin folders etc. This would allow multiple sites to use the same scripts.

Herein lies the problem though. For each site, the DisplayNews.php has an include of "../Config/Config.php". As such, when I try to create a symbolic link as:

cd /var/www/html/website1
ln /var/www/html/DisplayNews.php DisplayNews.php

and access the website, the DisplayNews.php file complains that it cannot find Config.php - because it's now looking in /var/www/html/News/Config instead of /var/www/html/website1/News/Config

Can this be done? Can I create a symlink (or other link) such that all the websites are looking at a common file, but that relative references (../) are processed as though the php page was a file and not a reference?

Confused....



Jim

KimVette 03-11-2005 06:27 PM

Symlinks will work however you need to configure the .conf file or .htaccess to allow symlinks to be followed - it is considered to be a less secure server configuration method so it is not enabled by default in the more responsible distributions.


All times are GMT -5. The time now is 07:25 PM.