ali raza

C#, .Net , and my thoughts

How to make better URI

  • It should be as short as possible. Don’t sacrifice consistency or obviousness, but be brief.

  • Organize and name things logically. ASP.NET isn’t always helpful in keeping a clean structure, so I highly recommend that you use a URL rewriting module. URIs should be ‘hackable’ – see

  • URIs should be deterministic.

    • No two URIs should ever display the same page

    • The same URI should always display the same content.

  • The query string should only contain data that AFFECTS THE QUERY. If it doesn’t describe the content, it doesn’t belong.

  • The URI path should not rely on cryptic or numerical identifiers. If it does, it should also provide a human-readable title. It’s really nice to be able to look at a URL and guess what it contains – especially when you have a long list of them. As a bonus, search engines absolutely love URIs that match keywords. Tip: Don’t try to spam URLs with keywords. Density algorithms are applied here, also. As with page titles, pick exactly 1 keyword and stick with it.

Further reading (written by Tim Berners-Lee):

Bad examples:

  • /Default.aspx?tabid=3

  • /Products/ShowProduct.aspx?prodid=4982

  • /showblog.aspx?articleid=98

Better examples:

  • /Default.aspx?tabid=3&title=ContactUs

  • /Products/ShowProduct.aspx?id=4982&product=Nokia_Wall_Adpater_12V

  • /showblog.aspx?articleid=98&title= Why_you_should_never_concatenate_SQL_commands


  • /contact/

  • /products/4982_Nokia_Wall_Adapter_12v

  • /blog/98_Why_you_should_never_concatenate_SQL_commands


One response to “How to make better URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: