Search code examples
htmlssi

Server Side Include (SSI) - Basic


I, for the life of me, cannot figure out how to get these to work.

I currently have a file that is named "included.html" that I would like to be posted on another page, "a.html". The "included.html" contains both HTML and CSS. So within "a.html", I pasted the following code:

<!--#include file="included.html" -->

That did not work. I contacted my hosting service to make sure they supported SSI and they said they did, just in the .shtml format.

So, I changed the file name to "included.shtml" and changed my code within "a.html" to the following:

<!--#include file="included.shtml" -->

Still does not work. I've even messed around with changing #include file to #include virtual. Doesn't work.

Any and all help is appreciated. Thanks.


Solution

  • Your server host is supporting SSI in pages that have the .shtml extension. Therefore, your include must be in a file with a .shtml extension, and the pages being included don't necessarily need the same extensions.