Slightly off topic, but I have some PHP also ;-) I am trying to make search engine friendly URLs for a site, but want this to be fairly dynamic and work with any new script and vars.
If anyone would be willing, I need help on a mod_rewrite rule or rules? I'm thinking it should be fairly simple, but I know nothing about reg expressions. Maybe not the greatest, but here's the code that generates the HTML with altered URLs. This works great, but then I need Apache to rewrite these. ---This: index.php?file=test&cmd=display&what=all ---Becomes: index-get-file-is-test+cmd-is-display+what-is-all.html --Here's the code: ob_start(); echo $htmlpage; $newdisplay = ob_get_contents(); ob_clean_flush(); echo rewrite($newdisplay); function rewrite($newdisplay) { $search = array( ".php?", ".php", "=", "&", "&"); $replace = array( "-get-", "", "-is-", "+", "+"); $hrefs = find_hrefs($newdisplay); $tmphrefs = str_replace($search, $replace, $hrefs); foreach($tmphrefs as $key => $array) { $newhrefs[$key] = $array.".html"; } $newdisplay = str_replace($hrefs, $newhrefs, $newdisplay); return $newdisplay; } //finds href=" in the string containing the html function find_hrefs($tmpcontent) { while($start = strpos($tmpcontent, 'href="', $end)) { $start = $start +6; $end = strpos($tmpcontent, '"', $start); $href[] = substr($tmpcontent, $start, $end - $start); } return $href; } TIA, Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php