Server-side includes (SSIs) allow you to include other files or dynamic content in your garden variety HTML document.
Commonly, SSIs are used to include things such as headers, footers, and “What’s New?” features across an entire site. When you need to change the background color of your site, for instance, you can change the header file only, and the color will be reflected immediately wherever you’ve included that file.
This is done by Apache before the page is actually shown to the user; he’ll never know what you’ve included or where.
SSIs, by default, are turned off; no worries, since
it’s quite simple to turn them on. Open your Apache
[Hack #89] and search for
# To use server-parsed HTML files # #AddType text/html .shtml #AddHandler server-parsed .shtml
Add lines tell us a lot. They
continue a pattern based on what we already know about CGI. If you
recall in our Turning on CGI [Hack #92] hack, we could have turned on the CGI feature for
files ending in
.cgi; in other words, any file
you created with the
.cgi extension (whether it
was a CGI program or not) would be treated as an executable script.
Likewise, these lines tell us that we can turn on the server-side
include feature for files ending in
Whether we actually use the SSI feature in these files
doesn’t matter; they’ll still be
treated and processed as if they did.
This is important. You may be thinking, if SSIs are so ...