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).
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With