Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: Search Engine Friendly Urls


Message #1 by "Daniel Tweedy" <daniel.tweedy@m...> on Sat, 18 Aug 2001 09:56:35
There's an article about this topic here:

http://www.topica.com/lists/PHP/read/message.html?mid=800529397&sort=d&start=42




--- Daniel Tweedy <daniel.tweedy@m...> wrote:
> I'd like to make my urls search engine friendly i.e.
> replace the ?, & and 
> = with /.
> 
> so instance this
> 'http://p2p.wrox.com/post.asp?list=pro_php' would 
> become 'http://p2p.wrox.com/post.asp/list/pro_php'.
> 
> I have tried to write a script that does that, but
> it times out all the 
> time on the regular expressions line, in my php
> file.
> 
> <?php
> 
> $urlVars=array();
> 
> getUrlVars($REQUEST_URI,$urlVars);
> 
> /*
> print_r($urlVars);
> exit();
> */
> 
> function getUrlVars($reqURI,&$urlVArr)
> {
> 
> while(ereg("/([^=/]+)=([^=/]+)(/|$|\?)",$reqURI,$m))
> 	{
> 		$urlVArr[$m[1]]=$m[2];
> 		$reqURI=ereg_replace($m[0],"/",$reqURI);
> 	}
> 	return $reqURI;
> }
> 
> ?>


  Return to Index