Forum Moderators: phranque

Message Too Old, No Replies

How can I SSI the same include file into several different sites?

Can't escape the user's home directory...

         

Fribble

12:22 am on Jun 27, 2006 (gmt 0)

10+ Year Member



I have small network of related minisites that I am building which I am interlinking. I want to simply use php to include a code snippet with the links so I only need to update one file if I make a change.

I'm running Linux/Apache with CPanel/WHM.

How can I do this? I have root access and it's not a shared environment but I can't seem to get out of the home/username/public_html directory. Any help is appreciated.

Fribs

crevier

6:08 am on Jun 27, 2006 (gmt 0)

10+ Year Member



Perhaps symbolic links will work? This will depend on how your files are laid out for each site. I don't know exactly what you meant by not being able to get out of "home/username/public_html" since you have root access. But if you can indeed get around that with root shell access, then perhaps this will work. Here's how mine is setup:

I have a public_html directory, under which I have the DOCUMENT_ROOT for each web site, plus a directory to hold my include files:


.../public_html/includes
.../public_html/site1 (www.example1.com maps to this)
.../public_html/site2 (www.example2.com maps to this)
.../public_html/site3 (www.example3.com maps to this)

I then make a symbolic link to the 'includes' directory, so that each of my web sites can see the files in it:

cd public_html/site1
ln -s ../includes .
cd public_html/site2
ln -s ../includes .
cd public_html/site3
ln -s ../includes .

Now, in the 'includes' directory, you can create as many files as you need, and each web site can see all of them. For example, create a 'copyright.html' file or 'links.html'. I don't use php much, but I believe the include syntax you'd use in each site would be something like this:

include('./include/copyright.html');

Fribble

7:20 pm on Jun 27, 2006 (gmt 0)

10+ Year Member



You're awesome, that works perfectly!

Thanks!