Using SSI on files with an .html extension


Server Side Includes (SSI) allows you to use a server-side scripting language to pull dynamic info (such as time, size, modification date, and even .cgi/.pl files) as well as basic scripting into normal HTML files.

See the following article to learn more about using Server Side Includes:

The following describes how to use SSI files on DreamHost servers.

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 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 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, add this one line:

AddHandler server-parsed .html

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) is 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
[server]$ chmod 744 yourfile.html

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?