[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

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
0
colinspurs
Asked:
colinspurs
  • 5
  • 5
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
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" -->
0
 
colinspursAuthor Commented:
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
0
 
Dave BaldwinFixer of ProblemsCommented:
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

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
colinspursAuthor Commented:
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
0
 
Dave BaldwinFixer of ProblemsCommented:
If you are already using PHP, I would use it to do the 'includes' instead of SSI.  If you use both PHP and SSI, then your page will run thru two 'filters'.  I don't use SSI on anything on the web.  I just had some test pages set up.  The only reason for me to use SSI would be if I didn't have PHP or javascript available.
0
 
colinspursAuthor Commented:
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
0
 
Dave BaldwinFixer of ProblemsCommented:
Curiosity question, why do you want to "de-php" that page?
0
 
colinspursAuthor Commented:
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.
0
 
Dave BaldwinFixer of ProblemsCommented:
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.
0
 
colinspursAuthor Commented:
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



0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now