Introduction to SSI (server side includes)

Don't worry, SSI doesn't require a rocket-science degree to understand and use. It is, however, a highly useful feature that lets you do incredibily time saving tasks such as include the contents of an external file across multiple pages on your site, or access and display server specific information such as the current server time, visitor's IP address, etc. In this tutorial I'll introduce new comers to the wonderful world of SSI! SSI is short for Server Side Includes, by the way.

Does my server support SSI?

The first thing that needs to be settled is whether your server supports SSI and have it enabled. SSI is a Linux/Apache specific feature, so if you're on a Windows server for example, you'll need to look for the Windows equivilant of SSI (sorry, not a Window's guy). To test if your server supports SSI then, you can run a simple test, by inserting the below code inside a webpage, and saving the page with a .shtml extension (the most common extension configured to parse SSI by default):

test.shtml source:

<!--#echo var="DATE_LOCAL" -->

When you run test.shtml in your browser, you should see the current date plus time of your server displayed:

Friday, 19-Jul-2024 13:55:25 CDT

If not, you can ask your web host about SSI support for your account, or try and manually enable SSI, by reading "Enabling SSI on my server."

With that said, lets explore some nify abilities of SSI now.

Go on to Page 2