Forum Moderators: phranque

Message Too Old, No Replies

which file extension .htm .html .php

         

jackdack

11:51 pm on Aug 7, 2005 (gmt 0)

10+ Year Member



Are there any implications for using any one of those three extensions (I'm using php & html)? I get the impression it's OK to use either but I wonder why some people choose.

My server is setup to parse php in htm/html.

Also, if you're not using the php extension, why use .htm or .html? Isn't one for unix, one for windows servers? Both work on my unix server.

Thank you

2by4

12:08 am on Aug 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I like using html or htm because then it doesn't matter what scripting language runs the actual programming.

HTML and PHP are platform independent. You can even run asp on unix if you absolutely must, bad idea, but you can do it.

Using PHP I don't like, it looks odd to me, the user doesn't need to know they are on a scripted page in most cases, I like to keep everything very normal. Other people are fans of using nothing, like /folder/file but it really doesn't matter in the end.

The one thing you should never use is shtml, that one makes me wince, that's such a weak scripting language you're probably going to end up running a real scripting language at some point on the pages anyway.

bill

8:45 am on Aug 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Why not consider using no extension at all? Then you're really future-proofing your site. The use of cruft free URLs has a big following in the blogging arena where you can automate this to some degree. Might be something you want to look into.

jackdack

10:42 am on Aug 8, 2005 (gmt 0)

10+ Year Member



thanks for the ideas. the cruft-free sounds very interesting, I'll have to research. Are there any disadvantages of having no extension?
Thank you

Farix

1:57 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



My server is setup to parse php in htm/html.

Also, if you're not using the php extension, why use .htm or .html? Isn't one for unix, one for windows servers?


If you have it set up to where .htm and .html files are parsed by the php engine, then you should remove them. You are causing unnecessary work for the server if it has to parse all of your HTML files as scripts. Reserve .php for when you need to run a script to generate content for the user and use .htm or .html when you don't.

As for the difference between .htm and .html, there are none. The only reason we have two extensions for the same MIME type is because of the old DOS naming convention of 8.3. Because DOS file extensions could be no more then 3 characters, the 'l' was dropped to fit. But since we no longer have to deal with the limitations of the DOS naming convention any more, then ideally you should use the full extension.

The one thing you should never use is shtml, that one makes me wince

First of all, Server Side Includes (SSI) is not a scripting language. Its primary purpose is to separate common elements--such as a menu--from a set of webpages and place them into their own file, which will be included into the webpage. This way, if you need to make changes to that element, you only have to edit one file instead of every single webpage.

The biggest disadvantage I found with SSI has to do with server support. As far as I know, only NCSA derived servers, such as Apache, support SSI. IIS, on the other hand, just ignores it. This, of course isn't a problem so long as you stick with Apache. But if you find yourself switching form an Apache server to an IIS server, then you will have to completely rework your website using a scripting language supported by the server, such as PHP.

Are there any disadvantages of having no extension?

Off hand, I would say you will have problems with MIME type. That is because MIME type is often determined by the file extension.

In the end, it shouldn't mater what the extensions are, so long as the correct MIME type is sent by the server and recognized by the browser.

2by4

6:26 pm on Aug 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Farix, not to argue semantics, but SSI does a lot more than include chunks, enough to where I'd call it a scripting language, albeit a very weak one.

jackdack

8:57 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



farix, thanks for the comprehensive reply, it was very informative and helpful My site uses a phpbb forum (obviously written in php). The rest of my site is html/css, using php includes and various php scripts in [my] html pages.

On that basis should I make my html pages .php or .html? (note, I'm using/integrating php includes and some php scripts - but I'm not a php scripter)

My server is configured to pass php within html. It's not a high load site. Isn't that a negligible performance hit on the server?

Finally (don't worry about this one as I can research), how does the lack of MIME identity for files with no extension cause a problem?

Thank you