InMotion Hosting Support Center

What is Server Side Includes?

Server side includes (SSI) are a method for manipulating web pages at the server level before they are sent to the visitor’s web browser. SSI uses tags so when the information is parsed, it cuts and pastes the information from another source into the webpage. Here’s what happens:

  • The server reads the document and parses it for directives.
  • Follows the instructions (directives) that it finds and merges the results into a final document to deliver to the client's browser
  • The final document is sent to the client browser for viewing.

Why are Server Side Includes Important?

If you have a lot of web pages and want to include information on all of them, this can be a huge asset. Instead of having to update all of your pages, you would just need to update your include file. So let’s say you use SSI for your footer on all your webpages. If you needed to make changes to the footer, you’d only have to update the includes file to do so.

Creating a "Hello World" SSI page

  1. The first step is to log into cPanel. We'll be creating two files for this example. Both files can be created using file manager within cPanel. The first file you will need to create is the helloworld.shtml file. Be sure you name the file with the correct file extension "shtml" or it will not work. 
  2. Once the file is created you'll need to use "code edit" to insert the following code into the file.
  3. <!--#include virtual="helloworld.php?var=Hello%20World" -->

  4. Next, you'll need to create the actual "include" file called "helloworld.php" This file contains the directives to be included in the webpage calling the include file. Make sure both files are in the same location or folder for this example to work. 
  5. <?php
        echo $variable;

So now, lets review whats happening during the SSI. The first file you created is including the file called "helloworld.php". The SSI include in our original file sets the variable for the PHP code. The code in the php file that is included tells the webpage to print the variable to the screen.

So as the server reads the initial file and finds that it includes the PHP file we created it loads that. It then parses the code and now knows to "echo" or print the variable defined in the original file based on the SSI. The end result is the variable "hello world" is printed on the screen.

If your SSI is successful you should see something similar to the screen shot below:


If you need further assistance please feel free to contact our support department

Was this article helpful?
Continued Education in Course Website Design
You are viewing Section 3: 302: Server Side Includes: An Introduction
Section 2: 301: Adding a Table to your Website
Section 4: 303: Using Server Side Includes with HTML Files

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

n/a Points
2015-09-06 10:15 pm

In order to use #include virtual via an index.shtml file, I had to add this to .htaccess file:


Options +Includes +ExecCGI

Took a while to figure that out. Hope it helps someone else.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

1 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!