[thelist] Regex Riddle

Bill Moseley moseley at hank.org
Sun Aug 29 07:38:41 CDT 2010

On Sat, Aug 28, 2010 at 10:05 PM, Frank Marion <lists at frankmarion.com>wrote:

> Search engine safe url: remember the time when search engines would choke
> on queries? People figured out to make the query look like a folder path.
> Now I just want to do it to make the urls short, memorable, and easy to
> type.
> So instead of
> http://www.example.com/index.cfm?foo=bar&poo=bear I can reduce it to
> http://www.example.com/foo/bar/poo/bear
> The way that I'm approaching it, because users can add their own content,
> they might add an internal link, that I'm filtering the final generated HTML
> and doing a search and replace on the whole thing.

Per rfc3986, paths are hierarchical, where query parameters are not.  So,
I'd be careful.  Different implementation might thus rearrange the query

But maybe you know the order of the parameters so can convert to a path by
some table lookup.  That is, you know the hierarchy so if you see a URL:


You would know to rewrite it as:


Bill Moseley
moseley at hank.org

More information about the thelist mailing list