Oldschool SSI HTML Includes

Developing front-end only and don’t want to introduce a server language just to include repetitive markup?

Add this to your .htaccess file:

1
2
3
4
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes

Then include partial HTML files using these:

1
2
<!--#include file="widgets/head.html" -->
<!--#include file="widgets/header.html" -->

Published by Walt

I'm a front- and back-end coder and team leader. I've been at this for 10+ years and have built 50+ websites that are true marketing tools: their effectiveness is tracked and attributable. I aim for user-intuitiveness, conversion optimization, speed, security, trackability, W3C standards compliance, responsiveness, browser- and device-consistency, WCAG-adherent accessibility, and pixel-perfect end products backed by data-driven architectures and designs. My specialties include WordPress and HubSpot, but don't stop there. Here are some sites I've developed.