Using Server Side Includes

Server side includes, commonly referred to as SSI, is a web scripting technique where content on separate files can be included in a webpage.

Server side includes are generally used to include Header, menu, footer and advertising content into a page. This is extremely useful with larger sites because the content on the single included file is shown on every page. So if a change is needed only the content of that one file needs to be changed for the update to affect the whole site. 

Server side included can be used with websites written in html

Creating content to be included

Create the code that should be included in a file and save it.

Code to include content

Place the following code where you want content included substituting the file location and name of your file.

<!–#include virtual=”/folder/yourfile.html” –>

Making the includes file display on all sites

Server side includes will show on pages with the extension .shtml without further code.

To make server side includes show on all file extensions add the following code to the .htaccess file

AddType text/html .shtml .shtm .htm .html
AddHandler server-parsed .shtml .shtm .htm .html


Leave a Reply

Your email address will not be published. Required fields are marked *