I am facing something like this issue, i cloned the live server to a sub-folder for testing purposes and created subdomain for it. Now 1- if i use subdomain.livesite.com as url (both secure/unsecure) all links (categories/products etc) on site target to livesite.com and 2- if I use livesite.com/subfolder as base url, category urls works but product urls still target to livesite
(links are not just redirected to live site, they actually had href attribute value of live site)
Note: As the other question is not answered yet so i don't think of my question as duplicate.