Cyberiot Home

Budget Hosting

Domain Search

Server Hardware

Free Newsletter

Search Website

FAQ

Support

Set-up Domain

 Contact Us

Recommend this Site

 

Renew Domain

 

Server Side Includes

SSI Server Side Includes

How to use SSI

The simplest example of server-parsed HTML is to have a file "foo.shtml" containing this text:

Line one
<!--#exec cgi="mycgi.cgi" --><P>
Line three

And then have a file "mycgi.cgi" that contains, on Unix:

#!/usr/bin/perl

print "Content-type: text/htmlnn";
print "Line Two";


And when you access "foo.shtml", it will output:

Line one
Line two
Line three


If your include directive is <!--#exec cgi="..." -->, then the cgi program you run must output a standard CGI header (Content-type: text/html)


Any file named foo.shtml will be parsed automatically by Apache on our servers.
Do not put any spaces before the '#' character in your include directives; if you have "<!-- #exec" instead of "<!--#exec", the line will be ignored.

Server-side includes in "custom trailers" will not work, since custom trailers are appended to the output of your web pages after all other processing has been done on them. Any server-side includes that you put into your custom trailers will be sent directly to the browser without being parsed.

More Help for using SSI can be found at:
http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html

Parsing html and shtml

By default, we don't set up our servers to recognize server-side includes (SSIs) in regular .html pages because there is a loss in performance when every single .html page is parsed.

IF You ARE NOT USING FRONTPAGE, you can set this up as a Mime Type in an .htaccess file.

Open the .htaccess file in the domain-www directory and add this line, or create a file named .htaccess and insert just this line:

AddType text/x-server-parsed-html .html

If you are using FrontPage extensions, you are out of luck. Using an .htaccess file will mess up FrontPage.

SSI test program

Simple SSI program to test if SSIs are set up to work on your domain:

#<HTML>
#<Head><Title>I was modified</Title></Head>
#<Body>
#<H1>I was modified</H1>
#<P>I was last modified on 
#<!--#echo var="LAST_MODIFIED" -->
#</P>
#</Body>
#</HMTL>

Save this as something like test.shtml in problemdomain.com-www and call it from a browser. If LAST_MODIFIED is replaced by the file creation date and time, SSIs work. 

Source: "Server Side Includes" by Reuven M. Lerner (Linux Journal, June 1998).

SSI that is not allowed

EXEC CMD

 

Cyberiot
Newsletter

Learning Series / HOW-TO create dynamic Webs

We write our own newsletter which is distributed free of charge. Articles of value, cut-and-paste scripts, free resources and success stories. 

Opt out at any time, no obligation to buy a single thing. We won't bore you with a million articles each week, short and to the point. Begin learning today.

  • How can scripts help me? 
  • Do I need a Database?
  • What to do with it!

What to expect?

  • MySQL tutorial
  • PHP tutorial
  • Cut and Paste codes to get you going
  • Simple layman's solutions for your site and budget problems
  • How-to save big bucks with small codes
Your Name:
Your E-mail Address:

 



Home FAQ Hosting Servers Support Contact
Search Domain Search Domain Renewal Affiliate Pass this on Policy

CyberRiot.net services may not be used for sites containing or linking to nudity or other pornographic material, illegal material, or other objectionable content.

Security software monitors our network every second of every day. Spamming software or porn are not allowed.

© Copyright 1999 - 2002 Cyberiot.com
All Rights Reserved