PDA

View Full Version : NS/Moz and SSI -- Source code loads instead of SHTML page


Deanna475
11-17-2003, 07:14 PM
Hello all. I wish to use an SSI command on my web pages so that I can use a CGI counter script. Everything works as it should in IE and Opera, however, when I view the pages in NS/Moz, the source code for the pages appears!! I am stumped!! Does anyone know why my .shtml pages are not loading as they should? Any and all advice is appreciated. Thank you.

Jeff Mott
11-17-2003, 07:35 PM
Well, executing SSI commands occurs at the server so that has no effect on the browser. My guess would be that some configuration option was set to treat an SHTML document as a plain text file. You'll have to check the browser preferences to see if you can find this option.

Deanna475
11-17-2003, 08:04 PM
Hi Jeff and thank you for your quick reply! Yes, the more and more I research this matter on the web, all information is pointing me in the same direction as you advised. I have just written my web host the following support ticket:

Hi. I wish to use an SSI command on my web pages so that I can use a CGI counter script. Everything works as it should in IE and Opera, however, when I view the pages in NS/Moz, the source code for the pages appears!! I have done some research on the web and the general consensus is as follows:

The problem is more than likely the Apache servers fault. Netscape and Mozilla are conforming to the HTTP spec (whilst most other browsers aren't). When a web server delivers a document to a browser the mime type of the document is specified in the HTTP reply header. If the server can't determine what mime-type it should use, it will fall back to a default, usually "text/plain". File name extensions are meant only to be used by the client side to determine the file type if mime-type information is not provided by the server. It really is the web server's responsibility to make sure that it gets the mime-type right.

Bog-standard Apache doesn't have a predeclared mime-type for shtml it appears. If you turn on SSI and choose to use shtml as the extension of all html files withh SSI directives, you need to either

A) Uncomment or add the directive
# AddType text/html .shtml

This is usually in the std example Apache httpd.conf file near the AddHandler server-parsed .shtml directive.

OR

B) add "text/html shtml" to the mime.types config file, THEN
restart the server to get it telling browsers the right thing.

OK, that having been said, I have tried some of the suggestions in the above article excerpt but with the same results -- source code showing instead of actual web page. In viewing the mime types in my control panel, I see that shtml is not listed and that I can add the mime type and proper extension. Is this what I need to do in order to get my .shtml pages containing SSI commands to view properly in NS/Moz? Or is there something that needs to be done at the server's end to ensure that .shtml pages are displayed properly?

I included all of that info in case it is of some help for someone else experiencing the same problem who has more control over their server's mime-types. I'm at the mercy of my web host, although they do stipulate that SSI is available. For a non-emergency support ticket, I usually get a turn-around time of 6-12 hours. We'll see what my web host has to say about this. Thanks for reinforcing what I think I was discovering at the same time you were probably typing your message. :)

Deanna475
11-18-2003, 01:14 AM
Well, to make a long story short: My web host answered my support ticket by telling me that SSI is indeed available on the server on which my domain is located and I confirmed that by looking at the Apache Handlers in my CPanel and there it was, right alongside .cgi and .pl. So I'm back where I started.

I'm trying desperately to figure this out on my own by researching the web but I'm not finding much in the way of how SSI and NS/Moz interact together. I've read some indication that perhaps I need to amend my <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

I've tried adding:

text/html/shtml
text/html/.shtml
text/html shtml
text/html .shtml
shtml
.shtml

to the above meta tag but none of those combinations worked. Am I even on the right track? Has anyone ever had this happen to them before that can offer some insight?

Deanna475
11-18-2003, 09:02 AM
I solved my own problem by going to the Moz Tech Support Forum and posting my question there. Here is what I was advised:

The MIME type the server sends will always overide the one that you put in your HTML. My host uses CPanel too. I believe that Apache Handlers refers to how a page is processed not what type it is. There should be another section called MIME types with two boxes, in the first box enter text/html, in the second enter shtml, then click add. This should make sure that all .shtml files are sent as text/html.

This works like magic. :thumbsup: