Tuesday, January 09, 2007

My Server Side Includes (SSI) Guide

I love server side includes (SSI). It's my most favorite thing in the whole wide world of making web pages.

Note : This is not a comprehensive SSI guide. What is server side includes ?

Here is my advice for using server side includes :

1. Ensure your server supports server side includes. Most paid servers do. Most free servers do not.

2. Add these lines to your .htaccess file :

Options +Includes
XBitHack on

3. Create the file to be read (inserted into another web page). I'll call that file ssi-read-file.shtml

With the option "XBitHack on" you shouldn't have to name the files with the extension .shtml - any extension should work. But name it .shtml just in case.

4. Inset the following code into the web page you want the contents of the file ssi-read-file.shtml to show up in. This may be your index.html file or some other web page.

<!--#include file="ssi-read-file.shtml" -->

5. Use a FTP program or some other means to change the permissions of the file in step 4 to 755 also known as -rwxr-xr-x (other permissions also work, play with this if you like)

Your SSI should now work. When you load the file from step 4 (index.htm, index.php, etc) the code from ssi-read-file.shtml shoud be displayed within it.

Apache SSI Guide

No comments: