SSI – a quick guideBack in April, I did some quick tests on how to get SSI under Apache. Here are my rough notes on that
SSI? What’s that?SSI is Server Side Include. It allows you to include files from within other files. If you’re getting serious about page composition, then php3 might be better suited to the task. But SSI might be just what you need.
The following URL might be helpful to you:
And this message talks about ExecCGI and mod_include:
And this resource might be helpful:
Enabling SSiI added the following to the Apache config file. It may be apache.conf or http.conf, depending on what version of Apache you are using. Be sure to edit the correct file. HINT: if you change the .conf file and find it has no effect, perhaps you aren’t changing the correct file. Search for this first. It may already be there.
AddType text/x-server-parsed-html .shtml
Then I created the following file within the website:
$ more testssi.shtml <html> <body> <!--#include file="testssi.inc"--> </body> </html>
Then, I created this file:
$ more testssi.inc hi mom
When you browse to the file testssi.html, you should see "hi mom". If you don’t, try the next section which might show you where you went wrong.
Problems and solutionsIf your page shows up blank, but when you look at the source, you see this:
<html> <body> <!--#include file="testssi.inc"--> </body> </html>
Then you haven’t turned on SSI. Try again. I found this in my apache.conf:
# # To use server-parsed HTML files # #AddType text/html .shtml #AddHandler server-parsed .shtml
I uncommented those two lines, HUP’d apache:
and tried again. Still no success. So then I found this option "Includes". So I added that to apache.conf under the directory in question.
<Directory "/www/test.freshports.org"> Options Includes </Directory>
And then it worked.