Universal Mod Rewrites

Posted by | October 27, 2006 | software design | No Comments

This mod re-write strategy seems to fall into the ‘duh why didn’t I think of that’ category of really simple but perfect solutions.

People use mod rewrites to trick google into indexing stuff create pretty urls.

Rails and a bunch of other frameworks force a grammar for links based upon actions and data when really most of the time there is no distinction made, there are just name/value pairs passed to the url. e.g. color=red is no different from colorit=red.

The strategy below loops through name/value pairs as url query string parameters and actually spits out the name and the value in the url:

site.com/name1/value1/name2/value2.

There are some potential problems with null values and ordering, but I like the idea.

Create Dynamic URLs With Mod_Rewrite and PHP Functions by www.Shadow-Fox.net