Sorry did not get you there specifically this part > > ---This: > > index.php?file=test&cmd=display&what=all > > ---Becomes: > > index-get-file-is-test+cmd-is-display+what-is-all.html
Anyway, I have written a rewrite rule to rewrite www.<subdomain>.some-domain.com to www.some-domain.com/index.php?somevar=<sub-domain> Is this what you are looking for? - Sid > -----Original Message----- > From: Shawn McKenzie [mailto:[EMAIL PROTECTED] > Sent: Monday, February 24, 2003 4:07 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: rewrite rule help anyone? > > No takers??? > > Did I say, Please! > > Thanks! > Shawn > > "Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php