Server Side Includes (SSI) let you pull content from one file into another with directives like <!--#include virtual="/header.html" -->, which is handy for shared headers and footers on a static site. By default only files with the .shtml extension are parsed for SSI. This guide shows how to make .html and .htm files support SSI too, and when a PHP include is the better choice.
Parse HTML files for SSI
Add this to your .htaccess in public_html: AddHandler server-parsed .html .htm. Every .html or .htm file is then processed for SSI directives before being sent to the browser.
01. What SSI Does
SSI is an older Apache feature that inserts the contents of one file into another at the moment the page is served, plus a few dynamic values like the current date. Its most common use is keeping a single header.html and footer.html that every page includes, so you update the layout in one place rather than editing every page. By default Apache only parses .shtml files for these directives.
02. Enable SSI for HTML Files
To have your existing .html and .htm pages parsed for SSI, add this handler to the .htaccess in your document root:
AddHandler server-parsed .html .htm
This lets you add includes without renaming files to .shtml, so existing URLs and links keep working.
03. Using SSI Includes
With the handler enabled, add include directives in your pages:
<!--#include virtual="/includes/header.html" -->
<h1>Page Content</h1>
<p>Your page content here.</p>
<!--#include virtual="/includes/footer.html" -->
Keep the shared pieces in an includes folder and reference them with a leading-slash (root-relative) path so they resolve from any page.
04. SSI vs PHP Includes
SSI is old technology. For most sites today a PHP include (<?php include 'header.php'; ?>) is more flexible and universally supported, and parsing has less overhead than enabling SSI site-wide. You can parse .html files as PHP instead; see How to Parse HTML as PHP.
Enabling server-parsed handling on every .html file adds a small amount of processing to each page. If you only need includes on a few pages, consider limiting the handler to those files, or move to PHP includes. For full .htaccess options see the .htaccess Guide.
Need Help With Server Configuration?
If includes are not working after adding the handler, open a ticket with the page and your .htaccess contents.
Open a Support TicketFrequently Asked Questions
How do I parse HTML files as SHTML for SSI?
Add AddHandler server-parsed .html .htm to the .htaccess in your document root. Apache then processes .html and .htm files for SSI directives, so you can use includes without renaming files to .shtml.
What is a Server Side Include used for?
SSI inserts one file into another when the page is served, most commonly to share a single header and footer across a static site so you edit the layout in one place. It can also output simple dynamic values like the date.
What is the SSI include syntax?
Use a directive like <!--#include virtual="/includes/header.html" --> with a root-relative path. Keep shared pieces in an includes folder so any page can reference them the same way.
Should I use SSI or PHP includes?
For most sites today a PHP include is more flexible and widely supported than SSI, which is older. Parsing every .html file for SSI also adds slight overhead. Consider parsing HTML as PHP instead, or limit the SSI handler to the pages that need it.
Quick Recap
- Add AddHandler server-parsed .html .htm to .htaccess.
- Use SSI directives like <!--#include virtual="..." -->.
- Great for static sites with shared headers and footers.
- PHP includes are more flexible for modern sites.
- Limit the handler to needed pages to reduce overhead.
Server configuration · Last updated November 2026 · Browse all General articles
