views:

128

answers:

6

Hi

I've seen a lot of dynamic website through the internet that their pages are in html or htm format . I don't get it why is that ? And how they do that ?

Just look at this website : http://www.realmadrid.com/cs/Satellite/en/Home.htm

+7  A: 

What you see in the URL can be set at will by the people running the web site. The technique is called URL rewriting.

How

On Apache, the most popular solution to that is the mod_rewrite module.

Seeing as you've tagged ASP.NET: As far as I know, ASP.NET has only limited rewriting support out of the box. This blog entry promises a complete URL rewriting solution in ASP 2.0

Why

As for the why, there is no compelling technical reason to do this.

It's just that htm and html are the recognized standard extensions for HTML content, and many (including myself) think they simply look nicer than .php, .php5, .asp, .aspx and so on.

Also, as Adam Pope points out in his answer, this makes it less obvious which server side technology/language is used.

The .html/.htm extension has the additional effect that if you save it to disk, it is usually automatically connected with your installed browser.

Maybe (a very big maybe) there are very stupid simple client programs around that recognize that they have to parse HTML by looking at the extension. But that would be a blatant violation of rules and was hopefully last seen in 1994. Anyway, I don't think this is the case any more.

Pekka
He is asking why, not how...
voyager
Read the question again :)
Pekka
he is asking "how" too ...
Lukman
@Pekka: point taken :)
voyager
There is a module that can do URL rewriting and works with ASP.NET (IIS 5), i will dig up the link for you :) , +1 anyway for mentioning URL re-write as how :)
Madi D.
Thank you , Actually both are my question , As you said i can do that via Url Rewriting . But why is that ? Whey they do Url Rewriting
Mostafa
@Voyager, I added a "why" part as I had overlooked that, cheers :)
Pekka
Here are some links for Asp.net rewrite modules : http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx , http://urlrewriter.net/ , http://www.urlrewriting.net/149/en/home.html
Madi D.
Pekka i think u meant to say , adam's answer not question :)
Madi D.
Thanks Madi D. :)
Pekka
Thank you all guys
Mostafa
A: 

They keep some pages as html because their content is not supposed to change frequently or not at all.

But you should also keep in mind the fact that some sites are dynamic but they change the page extention to html but original page remains same eg php or aspx, etc using htaccess or some frameworks like codeigniter etc.

Sarfraz
The linked page is most likely dynamic.
voyager
+6  A: 

There are a number of potential reasons, these may include:

  • They could be trying to hide the technology they built the site with
  • They could be serving a cached version of a page which was written out to HTML.
  • They could simply perceive it to look friendlier to the user
Adam Pope
+1,These are some good reasons, specially hiding the technology , keeps some of them kids whom learned a trick or two that works with a certain technology from applying them, and claiming they are "God-Like" hackers :)
Madi D.
+1  A: 

One possibility is just historical reasons. Pages that started static, now are generated dynamically, but sites don't want to brake old customer's favorites.

Ariel
+1  A: 

They might be using a server-side scripting language like PHP or ASP. You can configure what file extensions get parsed by the language by editing the web server configuration files.

For example in PHP the default extension is .php but you could configure the server to use .html, that would mean any files with the .html extension could contain PHP code they would get parsed before the page is sent to the clients web browser.

This is generally not recommend as it adds an overhead and .html pages that don't have any PHP would be parsed by the PHP engine anyway which is slower then serving pages direct to the browser.

The other way would be to use some form of URL rewriting. See URL Rewriting in ASP.NET

Camsoft
+1  A: 

Another reason is SEO(Search engine optimization). Many search engines like html pages and many guys(I mean some SEO specialists) think the html can improve the rank of their content in search engine.

sky100