Search code examples
htmltwitter-bootstrapssi

SSI Error with <!#--include virtual="file.html" --> [an error occurred when processing this directive]


So I am learning to properly use SSI and have done so successfully on one site. On a new site I am building on the same server I am getting the error [an error occurred when processing this directive] when trying to use the tag I have verified that SSI is enabled by using SSI to display the time and date with no problem. I have also verified spelling, and that the directory and file are there on the server. Not sure what is wrong, can SSI be partly enabled (allowing me to display the time with but not allowing include virtual)? Am I missing something obvious? Thanks guys!

Link to live test.

Code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Bootstrap 101 Template</title>

<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">

  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>

<!--#include virtual="/ssi/navbar.html" -->
<h1>Hello, world!</h1>
<!--#echo var="DATE_LOCAL" -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<script src="js/bootstrap.min.js"></script>
</body>
</html>

Solution

  • Your SSI tag includes /ssi/navbar.html. Since that begins with /, it is parsed as a full path based at the server's document root.

    http://christianstest.info/ssi/navbar.html

    However, that's a 404 Not Found. I assume you are trying to include this:

    http://christianstest.info/TestingServers/ComeRestTest/ssi/navbar.html

    You probably just need to remove the leading / in the SSI tag. virtual specifies a URL path relative to the current page, but you are pointing it to the root directory of the server.

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