Home
/
Website Help
/
Other
/
How to use Server Side Includes (SSI) in your pages?

How to use Server Side Includes (SSI) in your pages?

By default, if you want to use Server Side Includes in your files, they have to be with .shtml or .shtm extension. Alternatively, you can add the following line to your .htaccess to specify different file types that should be checked for such includes:

AddHandler server-parsed .extension

You can then add code to your pages that will be processed by the web server. This code should be in the following format:

<!--#"<tag><variable set>"-->

Find below a brief explanation of how Server Side inclusions are structured and how they work.

<!–# is the opening identifier, each Server Side inclusion should start with those symbols.

<tag> specifies the command that you can to send to the server. This can be: echo, include, fsize, flastmod, exec, config , odbc, email, if, goto, label, break.

<variable set> is a set of variables and their values. They should be added depending on the used tag.

–> is the closing tag. All of your SSI code should end with it.

Here is an example of how to include a PHP file into an existing page using SSI:

<!--#include virtual="/another-file.php" -->

Share This Article