NYCPHP Meetup

NYPHP.org

[nycphp-talk] Do you use Pretty URLs

Gary Mort bz-gmort at beezifies.com
Thu Dec 13 08:19:19 EST 2007


Cliff Hirsch wrote:
> > The next big task is making sure that all of the url links are 
> rewritten properly and that. That can be fairly difficult if your 
> links aren't very centralized.
>
> I see this as a big assumption on the part of many router/controllers. 
> If you are working in a framework, things will probably work. But all 
> it takes is one handwritten uri to muck things up. Most of the 
> routers/controllers I’ve seen expect or write something like 
> /param1/param2/param3, which assumes a certain order...and level of 
> knowledge.
>
> It seems to me that a more robust method would be to have something 
> like /param1/value1/param2/value2/.../paramn/valuen
>
> Wordier and exposes more about the application. But security by 
> obscurity doesn’t get you very far anyway.


It's also not pretty urls.

Here is an example:
http://test.com/index.php?option=com_adsmanager&page=show_category&catid=34&brandid=48

Now convert that in std format to:
http://nowhere.com/com_adsmanager/show_category/34/48
Or your proposal
http://nowhere.com/option/com_adsmanager/page/show_category/catid/34/brandid/48


Neither of these are "pretty" and their only real benefit is hiding 
things form search engines to make the urls look unqiue.


http://nowhere.com/find/widgets/acme.html

That is what I feel is a pretty url.

Where find summaries the whole component & action
widgets is the category
acme is the brand

Now someone searching on google looking for "acme widgets" will see the 
url http://nowhere.com/find/widgets.acme.html

Oh look, that is precisely what I'm looking for. I'll go there.

The thing is though, stuff like this can't be automated by some fire and 
forget generic routing app, it requires some intelligence.

The parm./value or /value/value format is great to get you from nothing 
to something, and as long as you have a way to customize the function 
for your needs, that seems great to me.



More information about the talk mailing list