Wednesday, November 26, 2014

Enabling Server Side Includes (SSI) on Apache and Debian/Ubuntu

Enabling Server Side Includes (SSI) on Apache and Debian/Ubuntu


Enable the Include module


a2enmod include

or


ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled

Edit the config file

vim /etc/apache2/sites-available/default

add

AddType text/html .shtml

AddOutputFilter INCLUDES .shtml

and

Options Indexes FollowSymLinks MultiViews +Includes

the complete file like below:


 DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
#Order allow,deny
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Options Indexes FollowSymLinks MultiViews +Includes
</Directory>

Restart Apache


service apache2 restart

Test,create shtml file


<html>
<head>
<title>SSI Test Page</title>
</head>
<body>
<!--#config timefmt="%A %B %d, %Y" -->
Today is <!--#echo var="DATE_LOCAL" -->
</body>
</html>


Enabling Server Side Includes (SSI) on Apache and Debian/Ubuntu

No comments:

Post a Comment