Example: I need to strip this url: www.example.com/dir1/dir2/page.html to www.example.com I'm trying to link to the site analytics page at Compete.com for each result in my search engine ( www.GoLexa.com ). However it will only accept the host url with nothing past the extension. Here's and acceptable call: http://siteanalytics.compete.com/www.cnn.com/ This would not be acceptable: http://siteanalytics.compete.com/www.cnn.com/news.html Here's what I currently have to make a call to Compete.com, I've stripped off the http:// leaving the url starting with www: http://siteanalytics.compete.com/".str_replace("http://", "", $val['redirecturl'])." This works fine as long as there's nothing past the extension. This is my variable: ".str_replace("http://", "", $val['redirecturl'])." Thanks, ED