Link to home
Start Free TrialLog in
Avatar of Colin Brazier
Colin BrazierFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Cannot get Server Side Includes working on my xampp for windows

Hi experts,

Much as the title suggests.  The included files are not appearing.

The xampp status page says SSI is enabled.

I have virtual servers, SSI doesn't work on any of them.

My .conf files are attached.

Any help appreciated.

Col
httpd.conf.txt
httpd-vhosts.conf.txt
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

I had this working on IIS: <!-- #include file="table.inc" -->
But on Apache on XAMPP, I had to remove a space before '#' before it would work: <!--#include file="table.inc" -->
Avatar of Colin Brazier

ASKER

Hi Dave,

Thanks for getting back...as it happens the space was already taken out.

<!--#include file="top.inc.html" -->

My searches showed I might have to rename the parent file .shtml.....is that really true?

Col
Yes, must have the 'shtml' extension because that's what defined in 'httpd.conf' for INCLUDES.  Starts at line 406.  Note that adding filters adds a step to processing files on the web server which is why they use a special extension for it instead of just 'html'.
#
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml

Open in new window

Okay thanks.

I am in the process of separating out my php code from my html - the current page is .php - so it may be a little while before I can test this properly.

The reason I want to use SSI is to include a standard piece of html - a navigation bar - in another html file.  SSI is the correct way of doing this, right?

I could add html suffix to the filter list but that would cause delays to all page loads I gather.

Cheers,
  Col
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hmm...OK thanks.  I'll go with that.  I was just trying to "de-php" this particular page. The points will go to your last answer but it all helped!

Col
Curiosity question, why do you want to "de-php" that page?
I am self taught and have ended up with a a badly written procedural site which should be alot easier to maintain than it is.  So I am embarking on a project to refactor it.  A big part of that is separating the php from html as much as possible, hence the attraction of an html solution to include other files.
I would probably start from scratch at that point.  If you know what you want to do now, it is often easier and quicker to just do a new version than it is to adjust, fix, correct, edit an old version.  I suggest you make an outline or a list of what needs to be done before you go any further.  And I am self-taught also.
Cheers - all good advice. I am pretty much starting again - I am not going to touch the existing site until the new one is complete and fully tested on my local server.

If you're interested, the current site is www.fobgfc.org

Thanks again for your help.

Col