LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-10-2005, 04:58 AM   #1
jimwillsher
LQ Newbie
 
Registered: Jan 2004
Location: Dunblane, Central Scotland
Distribution: Redhat 9
Posts: 29

Rep: Reputation: 15
Question 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
 
Old 03-11-2005, 05:27 PM   #2
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash: ln and relative paths tortle Programming 8 05-10-2010 05:50 AM
Absolute and relative paths Gins Linux - General 6 11-08-2008 08:48 PM
mkisofs & symbolic links to directories Imek Linux - General 1 10-28-2004 06:32 PM
relative/absolute paths in Java djgerbavore Programming 2 10-26-2004 08:01 PM
program that generates relative paths? TheMaXX Linux - Software 1 10-21-2003 02:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration