Well, I’m not sure exactly because it is A LOT of code, but to make it stop, you can use the filter ‘redirect_canonical’ and return false. like so:
add_filter( 'redirect_canonical', '__return_false');
So say you have a post named “mission” at http://mydomain.com/mission, but for some reason you really want to go to http://mydomain.com/mission-control/ instead of being redirected to the post, returning false with redirect_canonical will allow you to visit the url you want.
‘redirect_canonical’ is actually an SEO feature built into WordPress. This function redirects duplicate content like www.mydomain.com to mydomain.com among other things. Disable it with caution.