Fermilab Computing Division
Fermilab Homepage Computing Division Homepage Computing Division Banner

How to Set Up Server-Side Includes on Unix

Webmasters have the capability to enable parsing of your html pages. In each directory tree (subdirectories inherit the parsing option, unless overridden) that contains html files you want to parse, you can put an .htaccess file containing the following lines:

   Options +IncludesNOEXEC     AddHandler server-parsed .html

Security Note: In the Options line, +IncludesNOEXEC should be used (not +Includes) because the latter would allow executable server side includes which are a security risk and should not be used.

In the AddHandler line, the ".html" parameter specifies the extension of all files that should be parsed. If only a few of your files should be parsed, then giving them an extension of .shtml and using that extension in the AddHandler line will give more speedy results (because parsing a web page takes somewhat more time to service the page). Using another extension, like .shtml, may also require defining the mime type for that extension. In that case, insert the following line between the two lines above:

   AddType text/html .shtml  

The following line can then be used inside of your html file to implement the server side include:

   <!--#include virtual="/fnalincludes/footer.html" -->  

Please note that, unfortunately, a space between the -- and the # may cause the above line to not work.

For more information on Unix/Linux servers, see Apache Tutorial: Introduction to Server Side Includes. For IIS servers, see the Microsoft support site. 



 This page rendered in 0.397 seconds