Hi one of my friends is having a problem, so if anyone know anything about how to enable index.shtml instead of index.html on the webserver would you be able help me and my friend.

Thankyou

Dani AI

Generated

A few clarifications and a minimal checklist to complete what , and started: Apache will serve whatever filename the DirectoryIndex list prefers, but simply changing that list won’t make .shtml useful unless Apache actually parses SSI in those files. Two steps are needed: enable SSI parsing for .shtml, and make the .shtml name appear earlier than the .html name in the DirectoryIndex ordering so it gets chosen first.

If you can use an .htaccess in the site directory (and the server allows it), this is the usual, safe way to turn on SSI for that directory:

# in .htaccess (requires AllowOverride Options FileInfo)
Options +Includes
AddHandler server-parsed .shtml
AddType text/html .shtml

You must also have mod_include enabled on the server (Debian/Ubuntu: a2enmod include then reload) and/or enable the same directives inside the virtual host or main config if .htaccess is disallowed. To prefer .shtml as the default landing page, list the .shtml filename before the .html one in your DirectoryIndex setting for the vhost (the posts already pointed to DirectoryIndex ordering — keep it first).

Quick test and troubleshooting: create a tiny .shtml containing an SSI token such as

<!--#echo var="DATE_LOCAL" -->

If the browser shows a date, SSI is working; if you see the raw directive, parsing isn’t enabled or .htaccess directives are ignored. Check apachectl -M (or your distro’s module tools) to confirm include_module is loaded, and confirm AllowOverride includes Options/FileInfo if relying on .htaccess. Note also that parsed pages cost CPU per request — consider caching or generating static HTML for high‑traffic content.

Recommended Answers

All 6 Replies

In apache, find the httpd.conf, and find this line:

DirectoryIndex index.html

Add index.shtml to the end of that line.

mddv are you using Apache or IIS or something else for the webserver?

In apache, find the httpd.conf, and find this line:

DirectoryIndex index.html

Add index.shtml to the end of that line.

Exactly, and if I remember correctly apache check them in the order they are written as well. So if you use for example both index.shtlm and index.html you can decide which one to look for first. Not that I can think of a situation when you do, but there must be, since the option to is there. Or maybe not. :confused:

You should be able to write an .htaccess file and have it direct to your .shtml file instead.

so if I wanted both would it be:
DirectoryIndex index.html index.shtml ?

There should be a long lisrt in httpd.conf, and it is displayed in the order it is listed in that file. Here is a typical file:

DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.php4 index.php3 index.php index.phtml index.htm default.htm default.html home.htm

So if there are both index.html and index.cgi in the same directory - index.html will be displayed when no file is specifically called in the URL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.