• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

html, htm or xhtml?


Active Member
What's the best file type to go with? Does it make much of a difference?

We tend to go for .htm, just as a habit really.

I'm interested to know whether there is benefits to different types or which is the best to go for.


Staff member
normally html here too

Don't really see any difference to using htm to html myself, I rarely look at the address bar once is typed in or clicked on. Although I would probably write .html if I was typing out an address without checking it first


Active Member
I think some servers dont like done of the types (htm) I think can't remember any more than that I'm afraid.... go with .html


Senior Member
Use the XHTML Strict DOCTYPE and code with .php extensions. Make all files .index.php too. I can explain why if you like?


Junior Member
Are you asking what extension to give your filenames, or whether to use HTML instead of XHTML?

Extensions don't matter really. Assuming your server is configured for it, you could put "Filename.wibble" if you like :)


Senior Member
Well if you use PHP you can use includes (which you should be doing anyway). If not PHP then any other server side language really.

Calling them index.php and linking to site.com/about/ rather than site.com/about.php means that a) users don't have to know/understand any of your extensions and b) if site.com/about/index.php becomes site/about/index.html for whatever reason the link to site.com/about/ will still always work.


Junior Member
I haven't built a site that's just HTML for a long time, so I have no strong feelings on the matter. It's really nothing more than personal preference at the end of the day.

I agree with Harry that if you're doing a site that has repeated elements on every page, then it makes sense to break them apart and use includes for the common elements, using a server side language such as PHP. The folder setup for URLs (http://www.site.com/about/) is also a great solution since it's prettier and easier to remember (and can possibleyhelp with SEO too.)


Junior Member
I think it's OK if you only have a few pages/sub pages, but more than about ten and I agree this would probably become unmanageable. At that point you should probably switch to a CMS driven site anyway.


Senior Member
Xenonsoft said:
I find managing sites with lots of index.php's more difficult but it seems the best way to do it, I better take the plunge then.
Or I'm sure you could mod rewrite it…? Best to ask Jazajay though—he seems to know .htaccess etc quite well.
yep with mod rewrite you could have boobies.php and rewrite it so it appears as a directory in the browser ie www.ilove.com/boobies/ this is called a friendly url. This way you dont have to have millions of directories and index.php pages.

Just found the code to use in .htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)/$ $1.php