Apache2- Enabling SSI for HTMLs using .htaccess

Server-side includes (SSI) are the recommended way of including one html file in another. To enable SSI for file types like .html, .htm or .shtml on Apache2 server, you need to follow below steps:

Step 1: Enabling mod_include on Apache

Make use mod_include must be enabled and is running. This module is generally available with the default Apache 2 setup. To enable it on Debian, execute the following command:

Step 2: Set XBitHack flag

. XBitHack allows to parse files for server side includes as long as they have the execution bit set. Make below configuration in .htaccess file:

Step 3: Configure File type for SSI

Add file types to be enabled for server side include (SSI) in.htaccess configuration like below:

Add ‘Includes‘ to the Options directive in.htaccess:

So, the overall SSI configuration for various html file types would be:

Step 4: Restart Apache

Finally restart Apache to make the changes reflected.

Reference: MOD_INCLUDE