What are some practical uses for SSI?

My Taipei Baby


SSI as in Sever Side Include for webservers? There are lots of practical uses.

Probably the most common is the <#include> because you can include chunks of common code (navigation, header, footer, etc) and have it completely transparent to the browser. This really yields benefits on large websites where are aren’t using site management software. If you change your navigation bar, you only need to change 1 file.

Some minor usages are things like last modified date or current date.

Other more esoteric uses include serving up different pages for different browsers. To see an excellent example in action, go to theTAS Upper School web page. The header on top and navigation on the side are #include. If you’re using a DHTML compatible browser you can use the fancy floating menu in the header and if you’re not, it gives you a dropdown…all done with SSI.

However, Microsoft IIS server (at least with 4.0) only supported 4-5 SSI commands. Apache supports something like 20, making it much more flexible.



Thanks for the quick reply. I understand how <#include> could be used to make changes to footers, navigation bars, etc.

I guess what I mean is where else could I use <#include>?

Is there any use for them in the body of a page, like a story page?

Thanks for bearing with me,

My Taipei Baby


Ummm…I guess you could have different parts of the story in different files and #include them all into one page. You can use #include for anything; text, html, etc. Basically, it just puts pieces of the file together.

I’m not quite sure what you have in mind…


Okay, I’m finally starting to get this. I have this nasty habit of cruising websites and then taking a peek at the code, and I have seen some sites where the page is just made of a whole bunch of includes and I always wondered why they’d do that. I think it might be so that a visitor couldn’t select the text and copy it, or maybe so that people couldn’t see the code and grab it.

But maybe I’m getting ahead of myself because I’m still using Tripod for the site I intend to use the ssi for, and although I haven’t looked, I’m pretty sure Tripod won’t allow SSI. However, the host I’m thinking of using does, so I’d like to start figuring it all out.

Thanks again,


quote[quote]I have seen some sites where the page is just made of a whole bunch of includes and I always wondered why they'd do that.[/quote]

Hmm…you really shouldn’t see that unless they screwed up their server. The reason it’s called a SERVER side include is that the server puts the page together and serves it to the user. The user shouldn’t be able to tell (aside from the .shtml extention) that the page is dynamically created.