Welcome to WebmasterWorld Guest from 35.153.135.60

Forum Moderators: Ocean10000 & 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...

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

Full Member

10+ Year Member

joined:Apr 4, 2005
posts:268
votes: 0


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

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

Junior Member

10+ Year Member

joined:Sept 19, 2005
posts:44
votes: 0


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');

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

Full Member

10+ Year Member

joined:Apr 4, 2005
posts:268
votes: 0


You're awesome, that works perfectly!

Thanks!