Questions:
  1. Can I do something with .htaccess file so that I can have Server Side includes in a file that ends in .html and not .shtml ?
  2. Hi, I tried to do SSI, but I am having problem. This is my index.shtml file. !--#exec cgi="/home/username/domainname-www/cgi-bin/test.cgi" -- It is just not working. It always shows the message "[an error occurred while processing this directive]". Is there any way that I can see the error message on my script?
  3. I am trying to insert my header file into a CGI script I am running. To do so, I'm using {!--#include virtual="/header.html"--} (substituting { and } with < and > though), however, it's not parsing the HTML for the header document. Instead, it's leaving the SSI code used to try and implement the header file into the script in raw format. In other words, it's showing {!--#include virtual="/header.html"--} instead of the header's HTML. Please do keep in mind that I'm substituting the { and } with < and >. How can I get the script to parse the HTML of the header document?
  4. SSI that is not allowed?
  5. SSI test program?
  6. How do I use SSI ?

Answers:
  1. Can I do something with .htaccess file so that I can have Server Side includes in a file that ends in .html and not .shtml ?
    No, you cannot.

  2. Hi, I tried to do SSI, but I am having problem. This is my index.shtml file. !--#exec cgi="/home/username/domainname-www/cgi-bin/test.cgi" -- It is just not working. It always shows the message "[an error occurred while processing this directive]". Is there any way that I can see the error message on my script?
    you have the path wrong... the path is relative to the URL location, not the server path...
    it should be

    /cgi-bin/test.cgi

    NOT
    /home/username/domainname-www/cgi-bin/test.cgi

  3. I am trying to insert my header file into a CGI script I am running. To do so, I'm using {!--#include virtual="/header.html"--} (substituting { and } with < and > though), however, it's not parsing the HTML for the header document. Instead, it's leaving the SSI code used to try and implement the header file into the script in raw format. In other words, it's showing {!--#include virtual="/header.html"--} instead of the header's HTML. Please do keep in mind that I'm substituting the { and } with < and >. How can I get the script to parse the HTML of the header document?
    Well, you need to MAKE sure that the file is actully located in the same directory, and is called header.html
    AND, you would remove the / as you dont need that if you are calling from same dir :)

  4. SSI that is not allowed?
    SSI that is not allowed.

    EXEC CMD

    This is for security reasons and there are no exceptions.

  5. SSI test program?
    Simple SSI program to test if SSIs are set up to work on someone's domain or server:

    <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).

  6. How do I use SSI ?
    The simplest example of server-parsed HTML is to have a file "foo.shtml" containing this text:

    Line one



    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 , 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 "

    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