Use Server Side Includes

Server Side Includes (SSI) are codes you can add to your HTML document that tell the web server to include other content with the document being served. For example, you can use an #include statement to display the same header and footer on your pages automatically; if the information changes, you can save time by editing a single header.html or footer.html file. You can also use SSI for graphics such as logos or image maps that should appear on multiple pages.

On Webserve and IU Sitehosting accounts, pages that use SSI (#include statements) need the .shtml extension. Included files can have other extensions (for example, .html).

Note:
Websites on Webserve that use PHP were disabled on December 23, 2019. Users visiting IU websites still on Webserve using PHP will encounter an error page. All sites still on Webserve, regardless of content, will be disabled on March 20, 2020.
Note:
The #exec command is often used to run a CGI or Perl program from a web page; for security reasons, the #exec SSI is not enabled on Webserve or IU Sitehosting.

Use SSI with files in the same directory

In SSI, the #include statement tells the server to include another file:

<!--#include file="filename.html"-->

You can use SSI to display banner and header information, as in the following example:

<!--#include file="header.html" -->

In the above example, the #include statement appears in the body of the document, immediately after the <body> tag. In SSI, the process of including takes two separate files and creates one whole file. The server takes the SSI page and inserts it into the page calling it.

Use SSI with files located in different directories

If the SSI calls a file that is located in another directory in the account, use #include virtual instead of #include file. For example:

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

In the above example, the header.html file is located in the directory above the location of the file referencing it.

Footers

Page footers can be created dynamically, so that the date that the file was last modified automatically appears in the footer. The server side include statement calls another .shtml file, using this code:

<!--#include file="footer.shtml" -->

The footer statement on this page is placed at the bottom of the file, just before the </BODY> tag.

For more about using SSI on Webserve, see Server Side Includes tutorial.

This is document bfsa in the Knowledge Base.
Last modified on 2019-10-10 12:05:56.

Contact us

For help or to comment, email the UITS Support Center.