Jump to content

Server Side Includes


AnonymousX

Recommended Posts

I have recently been working on a project with a large number of links included in the navigation bar. However, I do not want to continuously update each page everytime there is a change in the links or in the scolling announcements. The first thing that was suggested to me were Server Side Includes. I was told to put the following command into the head tag of my website.<!--#include file="filename.html" -->However, this and several other similar commands didn't appear to work. I'd like to believe that our server is SSI capable (it's an Apple Apache Tomcat), so it puzzles me as to why it wouldn't work. I also know that if the code is even a little off, it won't work, and won't display an error message. Something else that was puzzling to me was that I could preview in my web editor and everything would work fine, but when directly opening the file, it wouldn't work.I was also told that I could use a javascript include, but if at all possible, I would prefer not to as javascripts aren't always compatible with browsers, and tend to load in a variety of ways. My questions are, does anybody have a good tutorial on how to use server side includes, or have an alternative method to the javascript so that I can get this site underway. Thanks!

Link to comment
Share on other sites

We initially began trying to use .html filetypes, but after several trials, found that it would not work. We then came upon the .shtml filetype and tried that but still couldn't get it to work. I don't believe we have tried an .asp file yet so maybe that might give us the result we want?

Link to comment
Share on other sites

Your server doesn't only have to be "SSI capable" but must also be configured to allow this. In Apache's configuration file, find:

<Directory />	Options FollowSymLinks	AllowOverride None	Order deny,allow	Deny from all	Satisfy all</Directory>

and turn it into:

<Directory />	Options FollowSymLinks +Includes	AllowOverride None	Order deny,allow	Deny from all	Satisfy all</Directory>

and add theese two lines somewhere else (on the end of the configuration file for example:

AddType text/html .shtmlAddOutputFilter INCLUDES .shtml

If that doesn't work... well... look at the How to tutorial from Apache.

Link to comment
Share on other sites

It depends on where you've installed Apache. On Windows, the default path is:

C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf

If it's not there, make a search for "httpd.conf". I doubht there will be other files named like that.By the way, from this file, you can adjust everything Apache has to offer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...