Server-Side-Includes on www.library.yale.edu
What is a Server-Side-Include?
It can mean several things. Here we are using it to insert text from one file into another file automatically when that file is sent to the browser. A common use would be to have a standard footer that is automatically appended to multiple pages. It doesn't HAVE to be a footer. You can insert at the top, in the middle, anywhere.
Note: The file includes the Server Side Include must have an extension of .html.
How to make a Server-Side-Include
- Start with the html file you want to use: example.html
- You need to have a file to include: footer.html
- Add the include tag where you want to insert the text from another
You don't have to put the included file in the same directory or subdirectory of the same directory. You can refer to files anywhere, but the syntax is slightly different:
Notice that this is the same as the path you would type into a browser,
- Server-side-includes are ON for the entire web server.
- The server will NOT send a "Last Modified" in the header when the page
is retrieved. This is because the page is "recreated" each time you ask
for it. If you really want the Last Modified of the page you can use a
Server-Side-Include for this too!
<!--#flastmod virtual="/~lso/workstation/docs/ssi/example.html" -->
- If you "view source" with a browser, you will not see the
includecode. That's because the server "creates" the file for you each time you request it.