views:

35

answers:

3

When using .htaccess to redefine the URLs for a site, there are two clear options:

  1. Provide no extension, as StackOverflow has done with URLs like http://stackoverflow.com/questions/ask
  2. Provide the extension of .html, regardless of the underlying technology, so something like http://stackoverflow.com/questions/ask.html

Are there any specific advantages to using one approach over the other?

Edit: Here is the article that made me consider using .html to fake a static implementation.

A: 

I think it depends on how much SEO friendly you want to make your site.

Consider this: today you have a vanilla ask.html static page. Tomorrow you might want to make it dynamic and replace it by ask.php which can take parameters. Having a site url change is not good from the SEO point of view. If ask.html is already popular and ranks near top on a google search, you will hate to change that. In these cases, having a permanent alias url (permalink) like /ask via .htaccess from the beginning will make more sense.

On the other hand, if you have a very high traffic static html page, then maybe page load can be a little faster if .htaccess is bypassed by having an url that directly references the file.

Joy Dutta
I think you misunderstood my question. In the second scenario I am talking about having `/ask.html` point to another file via .htaccess, just the same as the `/ask` situation. The question was whether or not there was any reason to have the `.html` included on the end. I'm updating the question to reference the article where I found this recommendation.
JGB146
Ah, I see. I think "pretty" urls having fake ".html" was popular in the past because search engines used to give more weight to what seemed like static content. Today's search engines are more sophisticated and the cosmetic fake urls might not be an advantage any more.
Joy Dutta
A: 

So far, the only factors I've been able to come up with are:

  1. Out-dated SEO factor: As mentioned in the article I linked, search engines used to give more credit to pages with a static file extension. This no longer appears to be the case.
  2. Subjective Aesthetic factor: In my opinion, the shorter (extension-free) listing looks more attractive, and requires users to type fewer character if they were ever typing your URL (or to use fewer characters anywhere they happen to paste your URL). I guess this could result in more link sharing by making it easier to link directly to your stuff on services like Twitter.
JGB146
+1  A: 

The first URL can be considered as a generic URL in contrast to the second URL that can be considered as a specific URL (specifying HTML as the content type).

Generic URLs are useful when using content negotiation. So /questions/ask can be used to request a resource that depends on client’s preferences (e.g. Accept, Accept-Encoding, and Accept-Language), location (localization), and time. On the other hand /questions/ask.html would be used to request a resource that is definitely HTML.

Gumbo
Thanks for the response! Enlightening. Would it be inappropriate to provide a generic URL that only served HTML content and did not do any kind of content negotiation?
JGB146
@JGB146: No, I guess not. In the end this is just a proposal on how a URL can reflect a generic or specific resource.
Gumbo