I have SharePoint 2013 on premise and we have O365 subscription and the idea is to have MySites and very basic team sites online with more sensitive and customized sites on premise.
I’ve set it up so that OneDrive/Sites and Newsfeed point to our Office 365 environment, using the Office 365 settings from CA, my issue is when I do a search for an employee and try to find their profile, I get User Not Found or if I click on an employee name next to a document, I get the same error.
MS says that they don’t support this setup out of box, however I found a script online that corrects the links so that it points to the correct URL mapping for each user; but that script breaks the newsfeed. If anyone has come across this, I’d appreciate a hand.
Here’s the script I have running: I place this file under layouts on my WFE servers and have UPS call this up.
<script language=”CS” type=”text/javascript”>Â Â Â Â void Page_Load(object sender, System.EventArgs e)
    {
    try
    {
    string account = Request.QueryString[“accountname”];
    if(account != null)
    {
    // Extract domain and name of user from the account name
    int stop = account.IndexOf(“\\”);
    string domain = account.Substring(0, stop);
    string user = account.Substring(stop + 1, account.Length – stop – 1);
   Â
    // Construct the SPO URL to redirect to
    string spoUser = String.Format(“i:0#.f|membership|{0}@{1}.ca”, user, “domain”);
    string spoUrl = “https://domain-my.sharepoint.com/Person.aspx?accountname=” + Server.UrlEncode(spoUser);
   Â
    // Redirect to profile page in SPO
    Response.Redirect(spoUrl);
    }
    }
    catch
    {
    // Handle error as necessary
    throw;
    }
    }
   Â
</script>