Welcome, Guest. [ Log In ]
Question   How can I use ssi on files with .html extensions?
Search KBase

Top 5 in this Area:
1. How do I use .htaccess files?
2. How can I turn off the default directory listing in a directory?
3. How do I block people coming from a certain website or URL from visiting my site or directory?
4. Can I use .htaccess files?
5. How do I stop "hotlinking" to my files?

How can I use ssi on files with .html extensions?
Our server is configured by default to only parse files with a .shtml extension with server-side includes. If you make sure all your files that include other files (using SSI) are named "something.shtml" you won't have to do anything to get them to work!

We realize that some people however have transferred a site from a different server configuration where any .html file was parsed for SSI. It can be a big pain to rename all the files in a website, as well as fix any links between them. Because of this, we allow users to turn on parsing of ANY sort of file they'd like.

To do this, simply create a plain text file named ".htaccess" in the directory in which you'd like all files with a different extension to be parsed for SSI. Inside the .htaccess file, put this one line:

AddHandler server-parsed .html
That's it! Now any file ending in .html will have SSI run on it! We really don't recommend doing this unless absolutely necessary. It adds some overhead to the web serving to parse in SSI, and so each and every request for a .html file (even ones that don't have any SSI in them) will be a little bit slower when you turn on this option. It's much better to just name the appropriate files with the .shtml extension if you can!

Last updated: Oct 22, 2003.

User Post (2004-10-08 15:44:49 by rockiess)
What the heck does XbitHack on do and why is it better than simply denoting files that have ssi in them as shtml?
User Post (2003-09-16 17:41:14 by dmmaus)
The "XBitHack on" directive indeed does use less server processing than simply parsing all .html files for SSI. I'd recommend doing that instead of the AddHandler, unless _all_ your .html files have SSI in them.
User Post (2003-07-19 06:06:35 by dobro)
what about serving javascript via ssi? that is, i have a navigation bar in javascript that i want to serve via ssi. do i just create the navigation bar page as normal and then have it serve over to the .shtml pages?
User Post (2003-05-26 08:15:02 by apatcher)
I don't really see how it is slower. Maybe because I'm using it with pages of 100Kb or less of text?
User Post (2002-10-31 18:40:26 by starmatt)
I will use this feature because ALL of my pages use SSI to include a footer. Also, many third party pages have links into my web pages. If I renamed all my .html pages to .shtml, it would break their links.
User Post (2001-08-29 22:59:15 by pika)
I have been creating a .htaccess file with

XbitHack on

then I chmod each file that I wish to have parsed for ssi to 744 (regardless of the file extesion). I am not certain, but I believe this method does not create as much server overhead as the AddHandler server-parsed .html.

I have been using this for quite some time without any problem.