views:

188

answers:

3

I have been trying to use Server Side Includes on my website to save time writing code and be able to change site wide elements quickly and easily.

However i cannot seem to get them to work, either locally or on the Server.

I have set them up as .html files (with only the code needed and no html or body tags) in a "ssi" folder and am calling them in the appropriate locations in my .shtml files with:

<!--#include virtual="/ssi/<filename>.html" -->

but still nothing. Any ideas?

A: 

It's possibly a path problem. Have you tried it without the leading "/" in front of "ssi"?

James
yes I have, and still no luck
0x783czar
+6  A: 

Is it Apache? Perhaps includes are not even enabled.

http://httpd.apache.org/docs/2.2/howto/ssi.html

To permit SSI on your server, you must have the following directive either in your httpd.conf file, or in a .htaccess file:

Options +Includes

dalbaeb
Right, it's Apache, didn't see the tags right away...
dalbaeb
+1  A: 

Have you enabled SSI on the Apache server?

You should have something like this in conf/http.conf:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

This means that .shtml files are parsed for SSI commands (not .html) files. Then, you need to enable if fr your Virtual Host, or directory:

Options +Includes
Julien