Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 35953)
+++ src/wp-includes/query.php	(working copy)
@@ -5009,6 +5009,9 @@
 					$link = user_trailingslashit( trailingslashit( $link ) . $endpoint[1] );
 				}
 			}
+		} else {
+			// If it's not an endpoint or a 404, there's something else associated with this URL. Let's not redirect anywhere.
+			return;
 		}
 
 		/**
