PDA

View Full Version : SSI problem


JanTM
03-15-2005, 05:49 PM
Fiddling around with SSI I can't quite get it to work the way I want to.

Including files using

include virtual="file.html" or include virtual="/subdir/file.html" works just fine.
That is I can include files in the same directory or any subdirectory.

However... what I am trying to do is
include virtual="/../../anotherdomain.com/html/file.html"
And that doesn't work at all. In fact I can't seem to include any file in which the path to it involves going UP the directory strukture.

I have even tried a direct path like this
include virtual="/home/username/domain.com/html/file.html" - which doesn't work either. Anybody have any ideas... because the manuals I find online says it "should" be working |cry|

swedguy
03-15-2005, 06:07 PM
"include virtual" goes from the root of the domain, for example:

http://domain.com/path1/something = virtual="/path1/something"

"include file" goes from current working directory

There's no way to include from outside the current domain, like /home/someotherdomain.com/....

JanTM
03-15-2005, 06:12 PM
Ach... not the answer I was hoping for. But thanks for clearing that up anyways. Another approach in then needed.

swedguy
03-15-2005, 06:16 PM
Hmmm, I just thought of couple of workarounds. You could try to include a PHP file that has this in it...

<?include("/home/user/anotherdomain.com/html/file.html")?>

Then include it with <!--#include file="file.php" -->


Or do it more versatile

In your html page:
<!--#set var="filetoinclude" value="/home/user/anotherdomain.com/html/file.html" -->
<!--#include file="file.php" -->

in file.php:
<?include($filetoinclude)?>

In file.php you have to have some security measures so evil people can't include any kind of file on your server. I just made it simple, just so you get an idea how you can do it :)

JanTM
03-15-2005, 06:31 PM
oh yes :)
That works like a charm. Thanks man :)

swedguy
03-15-2005, 06:32 PM
np :)