Reputation: 14438
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).
Upvotes: 7
Views: 5399
Reputation: 24637
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
Upvotes: 9
Reputation: 8
I had the same issue. Now I use xampp and I've added these lines before VirtualHost declarations
<Directory />
Options FollowSymLinks Indexes Includes
AllowOverride All
Order allow,deny
Allow from All
Satisfy any
AddType text/html .shtml .html .htm
AddOutputFilter INCLUDES .shtml .html .htm
<Limit PUT>
Order allow,deny
Deny from all
</Limit>
</Directory>
Hope this help
Upvotes: -1