Can I use Apache Server Side Includes (SSI)?
Our servers support Apache Server Side Includes (SSI). SSI commands allow you to add snippets of extra HTML code to your pages to do things like include the text of another page or display the modification date of the current file.
Apache offers a useful Introduction to Server Side Includes page that you may wish to browse.
Our server is already configured to allow SSI commands for all files with names ending in .shtml, so you can skip the "Configuring your server to permit SSI" section they provide. Just be sure your file name ends in
.shtml (such as "
index.shtml" or "
mypage.shtml") if it includes any SSI commands, otherwise it won't work.
Advanced topic: using SSI commands in .html files
We're occasionally asked, "That's all very well, but I want to use SSI commands in pages that end with
.html, and I don't want to rename all my pages to end in
.shtml. How can I do that?"
Before doing that, consider using the
XBitHack mentioned on the Apache page, for the reasons they list in the paragraph beginning "A brief comment about what not to do". Making all your pages get checked for SSI commands slows down your website and makes your pages uncacheable.
However, if most of your pages are going to have SSI commands anyway, it doesn't make any difference (your pages are going to be slightly slower no matter what you do), and advanced users can add this line to a .htaccess file at the top level of your site:
AddHandler server-parsed .html .htm
That's all it takes to allow any ".html" or ".htm" file on your site to include SSI commands.
If you're trying to mix both SSI and traditional scripts (such as PHP or CGI scripts), you can instead use this .htaccess command to make Apache examine the script output for SSI commands and run them:
Copyright © 2000-2019 Tiger Technologies LLC