Question
How do I enable server-side includes on my site?
Answer
One of Big Medium's system requirements is that your server have server-side
includes (SSIs) enabled. This server configuration is a common feature that
is often already enabled on hosted web accounts. If SSIs are not enabled,
however, the often has to be switched on by a server administrator.
If you run Big Medium on a hosted web account, check with your hosting
company for help with enabling server side includes. (You can also try
the "Edit .htaccess (Apache only)" method described below).
Here are three ways to enable SSIs:
Option one: Edit Apache's httpd.conf file
If you're running an Apache server and have access to its main configuration
file, named httpd.conf, you can enable SSIs by adjusting some settings
in that main file. The location of httpd.conf varies from server to server,
but here a couple of common locations.
On Linux:
/etc/httpd/conf/httpd.conf
On Mac OSX Leopard and Snow Leopard:
/etc/apache2/httpd.conf
On Mac OSX Tiger:
/etc/httpd/httpd.conf
Find these lines:
#AddType text/html .shtml
#AddHandler server-parsed .shtml
...and, if they are not already "uncommented," uncomment the two lines that
start with AddType and AddHandler by removing the "#" from the start of
those lines like so:
AddType text/html .shtml
AddHandler server-parsed .shtml
In more recent vintages of Apache, the lines to uncomment look like so:
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
Also, in the virtual server entry for the domain, be sure that you have an
Options entry that includes the IncludesNoExec option. The Options entry
can include other entries, too, but should at least include IncludesNoExec.
Something like this:
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Important. I strongly recommend that you do not use the Includes option
but instead use IncludesNoExec as shown above.
And finally, be sure that the DirectoryIndex setting includes
index.shtml. The DirectoryIndex line can include other options, too,
but it should at least include index.shtml. For example:
<IfModule mod_dir.c>
DirectoryIndex index.shtml index.html
</IfModule>
After making those changes, restart Apache, and all should be well.
Option two: Edit .htaccess (Apache only)
If you're running an Apache server that allows server configuration
via .htaccess files in your web directory, you can enable SSIs by
adding a file named .htaccess to your site's homepage directory
(or add to an existing .htaccess file if you already have one). The
settings to include in this file are:
AddType text/html .shtml
AddHandler server-parsed .shtml
DirectoryIndex index.shtml index.html index.htm index.php
Options +IncludesNoExec -ExecCGI
Server-side includes are immediately enabled once those settings have
been added to the .htaccess file in your web directory.
Option three: Enable SSIs on Windows IIS
If SSIs are not already enabled on your Windows server, only a server
administrator can turn them on. To do this:
- In the IIS Manager, go to "Web Service Extensions" and set server-side
includes to "Allowed."
- In IIS Manager, expand the local computer, right-click the "Web Sites"
folder (for all sites) or right-click a specific Web site,
and click "Properties."
- In the "Documents" tab, make sure that index.shtml is included in the
default content page list.