Cools URI doesn’t change:-
What makes a cool URI?
A cool URI is one which does not change.
What sorts of URI change?
URIs don’t change: people change them - Tim Berners Lee
I can’t believe that the article was written in 1998 and only now I can value how much it worth, at least for me. In php, there’s some way we could hide php so people won’t know that you are using php to generate the page. Somehow, this is considered as silly approach by certain people who argue that it is ‘security through obscurity’. To me , this is not a matter of security but more to how to present your application. Your user should not be burdened out to think how did you implemented the application. Their concern only lies in how to access it and use it. We could see everywhere from the typical forum board to e-commerce and government websites something like:-
http://forums.com/index.php?showtopic=17744&view=getnewpost
https://bank.com/mbb/scripts/mbb_login.jsp?do=Login
http://shop.com/customer.php?id=123&orderid=56
URIs that doesn’t really make sense to the user and sometimes even hard to explain. It totally against the ‘don’t make me think’ principle. Try to compare the above URI with these:-
http://forums.com/topic/17744/newpost
https://bank.com/login
http://shop.com/customer/123/order/56
With such URIs, you can even use it as an interface to the application. I want a details of customer with id 123, just go to http://site.com/customer/123. I want to see all the orders that customer 123 has made, just go to http://site.com/customer/123/orders. Using a a clean and consistent URI would uniformly structured your site. The second benefit to clean and uniform URI is it would abstract out your application. User don’t need to know how you implement your application. They doesn’t care whether you use HTML, PHP, ASP, JSP, Python etc to generate the page. They just want to access the page and get the information so why bother putting something like .html, .php in your URI ? By abstracting, it would also ease you in the process of migration. Let say you feel that php is sucks and want to implement your cool web 2.0 application in Python. Since your application were accessed by user uniformly through URI such as http://site.com/node/123, the migration could be done seamlessly without affecting how they will access your next cool application.
There’s few approach you could take if you want to implement a clean URL in your application. Framework such as Rails, Django or web.py support it natively and if you are using php, you can leverage the powerful apache mod_rewrite. Yeah, I mentioned somewhere in my blog that I hate mod_rewrite, now I have to take back that word. Drupal for example, use a simple mod_rewrite rule and a short function to parse the url and dispatch it to php callback. Simply put, it’s not hard to implement and it’s worth the effort. Tim Berners Lee was talking about it since 1998, at least we pay him some respects :)