This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host Web Hosting Help

Server Side Includes SSI

Server Side Includes (SSI)

Apache Handlers

This is what you would use to specify how to treat file types. By default, .html files will not run server side includes, but .shtml files will. To allow these you need to add a new handler for HTML:

To allow SSI, set the handler as 'server-parsed' and the extension as '.html' (without the quotes).

This will tell the server to read the .html files so that you may use these directives in them.

Follow these rules:

  • Commands and arguments are in lowercase letters
  • The double quotes around the value are required
  • There is no space until after the command
  • That hash mark (#) is required
  • There is a space after the second double quote, before the second double hyphen (at the end)

Here's the format of the SSI:

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

The above format will create an SSI that will include the text found in the file "included.html".

Why Use "file="?

You use "file=" when the file that will be included is held within the same directory as the file that is calling for it. You can also use the file argument when the file is within a subdirectory of the directory containing the file that is calling for it.

You would use the "virtual=" argument if the file you are calling for is located in a position requiring an address starting at the server root. This means the file isn't in the same directory as the page that's calling for it.

Many times an "includes" directory is setup that contains all of your include files. This is a popular method of doing things. If so, then you'll use the virtual argument to attach the SSI command to the files. Just make a point of giving the command the path from the server root (the domain name). Like so:

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

That forward slash before the first directory is representative of the domain name (server root for that domain).

/home#/username/public_html/ is the server root to your Main Site of your hosting account (where username is your cPanel username).

/home#/username/public_html/addondomain/ is the server root to an addon domain of your hosting account.

If you have a file located at /home#/username/public_html/addondomain/includes/includedfile.html that you want to include in http://www.addondomain.com/index.html, then your SSI format inside the index.html file would look like this:

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

By using that leading slash, the server will add the domain name to the front of the address for you.

Rule of Thumb Use "file=" when the included file is within the same directory as the page that wants it. Use "virtual=" when it isn't.

Note: You need to adjust /home#/ to /home/, /home1/ or home2/ or a different number depending on the home directory your account resides on. To view the home directory for your account simply view the stats column on the main cPanel page of your account and look for the home directory.

Additional Notes:
By Default, there is an Apache Handler on the server to parse .shtml files which already have server side includes (SSI) inside of them.

Please add this line of code to the .htaccess file to run .shtml includes in a regular html file.
AddHandler server-parsed .html

  • SSIs will NOT work until the DNS has propagated to the Just Host name servers. You will not be able to test them in advance by using something in the format of http://204.130.255.7/~username/test.shtml.

Knowledgebase Article 309,236 views bookmark tags: apache execute file handlers include script ssi


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

What are Apache Handlers? How do I setup customized Apache Handlers?
Knowledgebase Article 217,412 views tags: apache handler handlers

There are many ways that you can transfer files and folder to and from your hosting account. We highly recommend using an FTP (File Transfer Protocol) program to quickly upload and download files. We
Getting Started Article 324,249 views tags: file files filezilla manager setup

When I attempt to execute my Ruby on Rails application I receive &quot;500- Premature end of script.&quot;
Knowledgebase Article 167,671 views tags: premature rails ruby script

Related Help Content

This article will explain how to use Easy Apache to recompile Apache. This is useful if you want to change the version of PHP or change other PHP and Apache settings.
Knowledgebase Article 133,596 views tags: apache build compile dedi dedicated easy modules version vps

This article will walk you through uploading files using the File Manager
Knowledgebase Article 378,064 views tags: cpanel file upload

This article will explain how-to enable FTP on a newly provisioned VPS or Dedicated cPanel server. Since FTP is an unsecured connection point to the server, cPanel has it disabled by default in version 11.86 or prior.
Knowledgebase Article 44,015 views tags: dedicated file ftp root server transfer vps

I am trying to edit my web page and I have no idea how to? I need to know how to go into the site and fix it. My webpage has a error in the first paragraph. I don't know how to fix it? Can you help?
Knowledgebase Article 409,766 views tags: edit html upload webpage

This article will explain how to utilize GZip through the file manager.
Knowledgebase Article 229,450 views tags: archive compress compression decompress file gzip management zip

Instructions to set different character sets in HTML. Note: Not all character sets will be correctly rendered with this encoding format, but most will. You can find specific information about which ch
Knowledgebase Article 220,587 views tags: arabic change character chinese html japanese language languages sets

Hard refresh after changing the .htaccess
Knowledgebase Article 236,909 views tags: apache

In the newer versions of PHP, they have included a new directive to control and handle remote includes. We disable this option, by default, which may affect some of your PHP scripts.
Knowledgebase Article 179,523 views tags: include php remote url

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.