Using SSI on files with an .html extension

Creating an .htaccess file on your DreamHost web server

View the following article for instructions on how to create an .htaccess file on your web server:

If the file already exists, view the following articles for instructions on how to update it (depending on if you're using an FTP client or SSH):

Parsing all .html files

DreamHost’s servers are configured by default to only parse files with an .shtml extension with server-side includes. If you ensure 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.

However, some customers have transferred a site from a different server configuration where any .html file was parsed for SSI. It can be a difficult to rename all the files in a website, as well as fix any links between them. Because of this, DreamHost allows 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. DreamHost really does not recommend doing this, unless it is absolutely necessary. It adds some overhead to the web serving to parse in SSI as each and every request for an .html file (even ones that don't have any SSI in them) are slightly slower when you turn on this option. It's much better to just name the appropriate files with the .shtml extension.

Using XBitHack

Another way to accomplish this is to enable "XBitHack" via your .htaccess file by adding this line:

XBitHack on

Then, set the user execute bit on the .html file using either of the following commands:

[server]$ chmod u+x yourfile.html
-or-
[server]$ chmod 744 yourfile.html

SSI doesn't normally work when you're running Phusion Passenger (Rails and other Rack applications). This is because when the server receives a URL ending in a / it passes to Passenger. If you need to serve index files statically (including through SSI), your Phusion Passenger app must return a redirect to the appropriate file for such URLs, replacing ".../" with ".../index.shtml". The browser then requests the index file explicitly and SSIs function correctly.

See also

Did this article answer your questions?

Article last updated .