Index: wp-includes/rewrite.php
===================================================================
--- wp-includes/rewrite.php	(revision 20617)
+++ wp-includes/rewrite.php	(working copy)
@@ -305,21 +305,23 @@
 	$url_split = explode('?', $url);
 	$url = $url_split[0];
 
+	$home_url = trailingslashit(home_url());
+	
 	// Add 'www.' if it is absent and should be there
-	if ( false !== strpos(home_url(), '://www.') && false === strpos($url, '://www.') )
+	if ( false !== strpos($home_url, '://www.') && false === strpos($url, '://www.') )
 		$url = str_replace('://', '://www.', $url);
 
 	// Strip 'www.' if it is present and shouldn't be
-	if ( false === strpos(home_url(), '://www.') )
+	if ( false === strpos($home_url, '://www.') )
 		$url = str_replace('://www.', '://', $url);
 
 	// Strip 'index.php/' if we're not using path info permalinks
 	if ( !$wp_rewrite->using_index_permalinks() )
 		$url = str_replace('index.php/', '', $url);
 
-	if ( false !== strpos($url, home_url()) ) {
-		// Chop off http://domain.com
-		$url = str_replace(home_url(), '', $url);
+	if ( false !== strpos($url, $home_url) ) {
+		// Chop off http://domain.com/
+		$url = str_replace($home_url, '', $url);
 	} else {
 		// Chop off /path/to/blog
 		$home_path = parse_url(home_url());
