htmlserver-side-includes

Can't get Server Side Includes (one HTML file into another) to work


I can't get server side includes to work. I simply want to include one html file into another and I just can't seem to get it working

Setup

The server is a another machine (not localhost) running Windows XP. I've got a slighly older version of the xampp stack which is running only Apache/2.2.11

Virtual directory (in httpd-vhosts.conf) is configured as

<Directory "c:\www\dev1">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

index.html contains

A Big Block of Text<br />
A Big Block of Text<br />

<!-- #include file="test.shtml" -->

A Big Block of Text<br />
A Big Block of Text<br />

test.shtml contains

This is another line

What I am getting

From the browser on my dev machine, www.dev.com/index.html shows

A Big Block of Text<br />
A Big Block of Text<br />
A Big Block of Text<br />
A Big Block of Text<br />

Things I've tried

Read through a bunch of posts both here on stackoverflow and the internet and its helped "build" the basics for getting this to work (ie make sure Options has Includes enabled) but it still isn't working.

Changed

Options Indexes FollowSymLinks Includes ExecCGI to
Options Indexes FollowSymLinks Includes +Include ExecCGI to
Options Indexes FollowSymLinks +Includes ExecCGI

with an apache restart and it still doesn't work

Added .htaccess to the same directory as index.html and test.shtml

Options Indexes FollowSymLinks Includes ExecCGI 
AddType text/html .shtml
AddHandler server-parsed .shtml

and it still doesn't work.

Note. http.conf already has

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

enabled.

Yes, it is probably something real obvious but I've got a cold so if somebody could point me in the right direction, that would be greatly appreciated.

More Things I've Tried

Change include file to include virtual

I tried the suggestion by RichieHindle and it didn't seem to work and I've modified both my .htaccess and virtual directory configuration to include required combinations of AddType, AddHandler for both .html and .shtml ... still nothing

BIG NOTE: On the webserver, one can load a SSI checking webpage (via localhost in one of the xampp install directories) and it tells me that SSI includes are enabled and working, however, please note that my virtual directories are NOT in the xampp install directories; they are standalone under c:/www ... but I can't figure out how/why this makes a difference if I've configured the options outlined above in my virtual directory settings and/or .htaccess settings


Solution

  • Maybe try removing the space? From:

    <!-- #include file="test.shtml" -->
    

    to this:

    <!--#include file="test.shtml" -->