Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basic SSI not working

Tags:

ssi

This is doing my nut in. I'm trying to get server side includes to work. The server I'm hosting my site on has SSI enabled and the company that owns the servers said my issue is to do with my code, not to do with their servers.

Here's my file called test.html

<!DOCTYPE html>

<html lang="en">
<head>

<meta charset="utf-8">


</head>
<body>

<!--#include file="assets/includes/top.html" -->

</body>
</html>

The file top.html is just a bunch of html, nothing wrong there.

When I call the main file test.shtml it works fine. When I call it test.html it doesn't. When I googled this, it said it's to do with file parsing. How is this anything to do with the code? What can I do to make it work with the .html file extension. (I can't use .shtml for SEO reasons).

like image 853
CaribouCode Avatar asked Oct 09 '12 18:10

CaribouCode


1 Answers

Add the following commands to the .htaccess file:

# Enable server side includes
Options +Includes 

# pass .html files to the server for parsing
AddHandler server-parsed .html 

References

  • CGI Programming on the World Wide Web

  • Server Side Includes | Cheat Sheets

like image 98
Paul Sweatte Avatar answered Oct 20 '22 01:10

Paul Sweatte