Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 18545)
+++ wp-includes/functions.php	(working copy)
@@ -3694,7 +3694,7 @@
 		$url = WP_SITEURL;
 	} else {
 		$schema = is_ssl() ? 'https://' : 'http://';
-		$url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+		$url = preg_replace('#/(wp-admin/.*|wp-login.php)#i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
 	}
 	return rtrim($url, '/');
 }
