3

First, I'd like to preface this question by stating that I insist upon publishing a file name suffix, but only on the outer most entity of our site, the detail pages. I do realize the suffix is not necessary, and as such, some people just don't use it in their URL rewrite rules.

Our basic logic is as follows:

  1. Top Level: h t t p://no-host-name.just-the-domain.tld/
  2. Next Level Deeper, append a "directory" of: /most-general-groups-of-entities/
  3. Next Level: /additional-specificity-like-location/
  4. Next Level: /more-specificity-making-a-smaller-group/

Each level is one click deeper, making all site content no more than four clicks deep -- good for getting spidered. ALSO -- and I like this "feature" -- you can actually remove the right-most piece of each rewritten "directory" and it will serve a page that is a list of links to all of the groups of data belonging to the classes depicted in the directories comprising the rewritten URL.

The fourth click down results in a detail page, such as: name-of-entity.html

So the question: what should I write as a suffix to the file name?

It seems to be mis-leading to rewrite the URI having a suffix of html. I do believe the consensus suggests (still?) that .html is most favored. However, our technology platform, more accurately, would publish content using a page suffix such as .php or .asp. I do recognize there is a slight security benefit to masquerading the suffix that tells the world what your platform is.

However, isn't it kind of black-hat-like to use a suffix of .html? Paranoia causes me to believe that Google may detect URL rewrite and potentially trigger the so-called over optimization penalty.

Supporting use of the HTML suffix is the fact that we are, indeed, serving HTML content to a browser. It would make less sense to arbitrarily pick .pdf or .doc -- which sometimes scare away clicks when seen among search results.

Also, to reiterate my earlier insistence that I prefer to use a suffix, it's because it completes our depiction of a logical hierarchy:

  1. the site
  2. rewrite directory one - the general silos of information
  3. rewrite directory two - a folder containing more folders
  4. rewrite directory three - the folder that has the documents
  5. rewrite document name

All directories end in a forward slash, and in contrast, documents, at least typically, have a suffix and do not have the trailing slash.

I recognize there are certainly other dragons to slay in the course of a workday, but at the moment I am trying to finish up our URL rewrite, which makes this top of mind for me.

Can anyone cite examples to encourage or discourage the rewriting of a suffix of any particular type? And, please, if you see errors in my logic or directory hierarchies, I want to hear what you have to say. Thank you.

5
  • 4
    Perhaps this question might sway you away from totally unnecessary file extensions: webmasters.stackexchange.com/questions/3079/… Commented Nov 11, 2010 at 18:47
  • 2
    It is perfectly kosher to name an HTML document *.html. PHP/ASP/etc. are just server-side middleware. They can output any type of data they want. It doesn't matter to Google, web browsers, or users what is used to generate the HTML/XML/RSS/JSON/SVG output. The .php/.asp extensions are just used so developers know what type of file it is and for web servers to know what to parse the files with. If you're using rewritten URLs, then those extensions are irrelevant. Commented Nov 11, 2010 at 21:26
  • 1
    I did this once, to rewrite .aspx pages into .html but I made a big mistake - I had a .html file by the same name. One day the rewrite engine broke and users were sent to the .html page. The .html was an alpha-development version of the page and I had written some... less than flattering and quite obscene placeholder text describing the troubles I was having. Approximately 1000 people saw this and I was chewed out big time. So it pays to be careful. Commented Nov 11, 2010 at 23:54
  • @Farseeker: I think the lesson there is to keep better track of your file versioning and not have development files on your production server...or maybe avoid venting frustration where customers can see it (I like to keep them in comments in server-side code ;-P). Commented Nov 12, 2010 at 0:56
  • @Lèse - you should see some of my de-minified JS documents... filled with IE6 hate they are Commented Nov 12, 2010 at 1:30

3 Answers 3

5

Google is not going to care what you use for the suffix.

Personally I would suggest you use .html simply because it says nothing about your underlying technology platform. Or, be deliberately deceptive and use something like .php on an ASP.NET site.

From a security perspective this gives as little information as possible to anyone who might want to hack your site. I know it's "security through obscurity", but that doesn't mean it isn't effective in discouraging a casual hacker (or an automated bot).

1
  • HTML it is. More ambitiously, even, you could respond accordingly to the suffix at the end of the URI, returning .xml or .json data (perhaps others, within reason). Given that I'm returning .html, then it has context, despite the fact that it's not a static HTML file. Commented Nov 12, 2010 at 16:17
4

However, isn't it kind of black-hat-like to use a suffix of .html?

Web servers have been returning URI's ending in .html from the inception of HTTP - nothing wrong with using it today.

Paranoia causes me to believe that Google may detect URL rewrite and potentially trigger the so-called over optimization penalty.

Unless Googlebot has access to your server configuration or log files, I think you really are being paranoid (i.e. suspicious to the extent that productive behavior is affected).

The idea of an "over-optimization penalty" seems pretty far-fetched ... after all, if you're being penalized for it, it must not be optimization, n'est pas?

Use a canonical URL for each document to avoid any potential indexing problems and return a 404 if the URI is called without the extension you have made canon. (Google can't very well detect a rewrite for which no redirect header is returned)

1
  • 2
    Over-optimization penalties are real. Matt Cutts has admitted as much. It's just that the term "over-optimization" was coined by SEOs as a euphemism for creating spammy sites, which Google is increasingly cracking down on. It's definitely not optimization, much less over -optimization--that's just the euphemism that scummy SEOs use. Commented Nov 12, 2010 at 1:00
2

I would go with .html. The W3C actually recommends this practice in its CHIPs Note, and for two good reasons:

  1. To disguise the technology you are using today
  2. To keep your options open on the technology you will use in the future

Even Tim Berners-Lee himself recommends not using technology-specific file extensions in his famous article “Cool URIs don't change”. In one example, he points to how old-fashioned a Perl .pl extension looks – and Tim wrote this article back in 1998!

2
  • Where is this recommendation in the CHIPS Note? I can only find the opposite recommendation: not to use file extensions (3.1, 3.2).
    – unor
    Commented Jan 1, 2014 at 3:52
  • 1
    I was refering to - Guideline 3: Use independent URIs - w3.org/TR/chips/#gl3 You are right in that it does not say to actually say to use .html as an extension, but in this instance, I was recommending it to the OP of this question, who insists on using a file extension of some sort. Commented Jan 1, 2014 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.