Tuesday, 10 September 2013

SSI File in a Sibling Directory on Linux, Apache

SSI File in a Sibling Directory on Linux, Apache

I have a Linux server with Apache, where I am utilizing .shtml page
extensions to call in Server Side Include (SSI) files.
I have used many hosting environments where I can use separate directories
that are sibling directories to where my page is. So, for instance, I can
have a PAGES folder and an INCLUDES folder, and therefore can pull in the
include content into the page, using a directive like this:
<!--#include file="../includes/header.html" -->
Unfortunately, this is not working for me on this particular Linux server
I am on.
Interestingly, if I put the include file IN or UNDER the pages directory,
it works. So these two examples work:
<!--#include file="footer.html" -->
<!--#include file="includes/header.html" -->
But it does't work if I try to use that same directory using "relative" dots.
So this works…
<!--#include file="includes/header.html" -->
...but accessing the same directory through dots doesn't...
<!--#include file="../pages/includes/header.html" -->
Similarly, changing
file=" "
to
virtual=" "
doesn't work either. Nor does an absolute path.
I have read where it says that file="" won't allow for the ../ or the
absolute path, therefore eliminating references to files that are further
up in the directory structure… but those explanations usually tell me to
just use the virtual command, and that doesn't work either. (Server
setting?)
And yet, I am reasonably sure I have done this on other Linux servers.
I have called the host, but they weren't able to help much.
Is there a certain way I configure an .htaccess file to make this work?
Any suggestions? Or, a confirmation that it simply won't work and that I
shouldn't keep trying to make it work?
Thanks!

No comments:

Post a Comment