Index: wp-includes/class-wp.php
===================================================================
--- wp-includes/class-wp.php	(revision 19601)
+++ wp-includes/class-wp.php	(working copy)
@@ -481,6 +481,12 @@
 					status_header( 200 );
 				return;
 			}
+			
+			if ( (site_url() != home_url()) && ('wp-admin' == substr( $this->request, 0, 8 ) || 'wp-login.php' == substr( $this->request, 0, 12 )) ) {
+				wp_safe_redirect(site_url($_SERVER['REQUEST_URI']));
+				exit;
+			}
+
 			$wp_query->set_404();
 			status_header( 404 );
 			nocache_headers();
