What are SSI (Server Side Includes)?

June 25th, 2008 · No Comments

SSI stands for Server Side Includes. You might have seen SSI as a web hosting feature on some web hosts.

Let’s see what it’s all about and what you can do with it.

Server Side Includes (SSI) is a simple scripting language made mostly for the web. As its name implies, it consists of including the content of a file into another dynamically. The included file could be a plain text file, a Perl script or a command shell script among others. There are also some directives you can use to display various informations like date and time or HTTP environment variables.

HTML files using SSI usually have the .shtm or .shtml extension but it’s possible to configure a web server to parse all .html files for Server Side Includes.

Here are some examples of things you can do with SSI.

Displaying The Remote IP Address

Putting this SSI tag between <body></body> of your webpage will display the IP address of the visitor:

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

Including The Content Of Another .HTML File

Putting this SSI tag between <body></body> of your webpage will “paste” the content of banner.html where inserted:

<!--#include virtual="banner.html" -->

This way you could change a banner on your entire website just by altering banner.html (I know, I know, there are better ways of managing ads, like with OpenX).

Executing A CGI Script And Displaying The Result

Insert this SSI tag in your web page to execute a CGI script and send the result (if there’s one) to the web browser:

<!--#exec cgi="/cgi-bin/helloworld.cgi"-->

There are other things you can do like use conditions (IF… THEN) so I’ll point to some resources at the end of this post.

So SSI can be useful to do some basic stuff quickly without a lot of coding but more complex server-side processing is often achieved using PHP, Perl, ASP, JSP and Ruby On Rails.

Here are some resources on Server Side Includes if you would like to know more:

0 responses so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment




Posted in Misc · Tutorials | No Comments

Dedicated Servers
 
VPS
Website Hosting
 

Recent Comments

Recent Webmasters

Hosting Type :
Monthly Price :
Storage :
Transfer :
Sort By :