[thelist] SS Include question

Anthony Baratta Anthony at Baratta.com
Thu Mar 27 19:36:17 CST 2003

At 02:10 PM 3/27/2003, Jamie Bakum wrote:
>>If you could pass on just your SSI directive that would help.
>I've been using this:
><!--#include virtual="../nav/top.html" -->
>(and I tried variations with "include file" with an absolute path to no avail)

You can parse any text file as long as the server is told to. .shtml is the 
official default, if globally enabled in Apache. Also an include file can 
be any text file, and if it has an extension that is listed as "ssi parsed" 
then it too will be parsed for SSI.

First off, you shouldn't be using relative links with SSI when you use the 
virtual paramater. Relative links work with the file parameter.

Let's say you have an include file called top.html (i'm so original ;-). It 
lives in the directory nav which is just off the web root. If you were to 
call the file directly via your browser you would type:


So I decide to use this for every page on my site. The "most best-est" way 
to include the file is to use the following convention for every page, no 
matter where on the site the page including the file is.

         <!--#include virtual="/nav/top.html" -->

Virtual (by definition) starts from the web root, just like pathing 
information after your domain name in the URL. If you use this convention 
you don't need to worry about how deep you are in the directory structure 
because you are always going back to the top then drilling down to find the 
include file.

If you tried to use the ../.. convention instead of starting from root, for 
each tier in your directory structure you'd have to add a new ../ to go up 
one more directory. That does not make management of your SSI directives 
easy. It's much more efficient to use the full virtual path in each page, 
no matter where on the server that page is.

The Apache Group has a good tutorial on SSI Directives:


Hope this helps, or at least does not hurt.
Anthony Baratta
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."

More information about the thelist mailing list