Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

Why don't the SSI (Server Side Includes) I have set up on my web pages work?


SSI is a very useful feature of the Apache web server but there are some common problems encountered in getting it to work. Problems are usually caused by one of the following scenarios:

- Web pages not being accessed through the web server.

Problem:
SSI is a feature of the web server and consequently any SSI directives included in a web page only work when the page is served up by the web server. For example if you are designing your web pages in your home directory and viewing them by opening the HTML file directory via your browsers "File/Open file..." menu option then the includes will not do anything

Solution:
Always upload your web pages to the web server when using SSI directives.

- SSI not enabled in web server configuration file.

Problem: By default most Apache installations are not configured to support SSI directives in web pages.

Solution:
Edit your httpd.conf file to enable Includes. You will typically find this file in /etc/httpd/conf. The directive that needs to be set is as follows:

    Options +Includes

- Web server not configured for required file types.

Problem:
In order to prevent every web page being scanned for the presence of SSI directives (considered to be an unnecessary performance overhead) the server must be configured so that it knows which filename extensions typically require SSI processing.

Solution: Configure the server to look for particular files that will include SSI directives. This can be achieved in a number of ways:

- Apache can be configured to parse any file with a particular file extension, such as .shtml, with the following directives in the http.conf file:

        AddType text/html .shtml
AddHandler server-parsed .shtml

This is a great approach when you know in advance whether a page needs to use server side includes or not but can be a problem if you need to change an existing page since you would have to rename the page to use the new filename extension and also change any links that point to this file.

- Use the XBitHack directive in the httpd.conf file:

        XBitHack on

XBitHack tells the Apache server to parse files for SSI directives if they have the execute bit set. In other words, to add SSI directives to an existing page, you simply need to make the file executable using the chmod command. For example:

        chmod +x mypage.html
More detailed information on SSI and Apache can be found in the Linuxtopia How to enable SSI (Server Side Include) support on an Apache web server How To Guide.

 
 
  © Copyright 2005-2010 Linuxtopia. All Rights Reserved.