Mangling URLs for RewriteRule parsing

From: Date: Wed, 13 Jul 2011 00:52:46 +0000
Subject: Mangling URLs for RewriteRule parsing
Groups: php.general 
Request: Send a blank email to php-general+get-314029@lists.php.net to get a copy of this message
I'm fumbling trying to think of a nice easy way to mangle my URLs within PHP for SEO and apache's RewriteRules magic. Given a basic rule like this: RewriteCond ^/foo/movie/genre/([-a-z\|]*)_([-a-z\|]*)/([0-9]+)/videos.html$ RewriteRule /browse_scenes.php?&genre_id=${genres:$2}&pg=$1&%{QUERY_STRING} [NC,L] I currently have a wrapper createPageLink() that right now just spits back the 'ugly' URL style. (ie. the 'Rule' portion), but what I want it to do is spit back the nice 'Cond' part instead) Do I just have to make a giant switch/case statement for all the 'browse_scenes.php' and other .php pages? It seems to me that I should be able to dynamically build the URLs that are inserted into my .php page (the ones that show up in the browser bottom bar on hover). I'm fairly flexible at this point as I'm just starting to do this SEO stuff, so I thought I'd ask if someone has a nice function or class or something that has already solved this kind of problem? Or is it such that every site is unique and no such 'generic' kind of wrapper exists? I guess I'm thinking of methodology or best practice type code, rather than a turnkey solution if none exists. d

« previous php.general (#314029) next »