Nerd Quizzer

I’ve got an Apache need and I’ve hit my limit with mod_rewrite and regular expressions. I’ve tried using a Rewrite Map (thanks, Jon!) amongst other things.

Problem: I need to replace incoming URL requests that have underscores with URLs that have dashes. Since the URLs (URIs? UTIs?) were dynamically generated, the rewrite rules only need to replace the underscores with dashes. So “site/archives/2002/12/25/donkey_kong_pants_fiends” needs to be “site/archives/2002/12/25/donkey-kong-pants-fiends”. Should not require a great deal of calculus, but it appears it does.

I’ve thought about a smart 404, but then won’t that dork searchbots? Wouldn’t it be better to do a simple redirect? Why is this so hard? Is there a God?

Nerd tutorials start with a stick figure in step one and then in step two show a Da Vinci masterpiece. All in code. There’s a reason that I’m a nerd dilettante and not a nerd. I need the stick figure to evolve slowly into a slightly better stick figure.

I’ve also thought about a quickie PHP file that would do the job, but not sure that’s the best way to go.

Thoughts, oh great internet?