title: Routing doesn't work properly when URL clicked in Word or Excel (PHP, Laravel)
body: <p>We have an application running on PHP 5.5 &amp; Laravel 5.2. It has a user account area, in which all routes are prefixed by /account/. The default route for the account area is /account/services. Users are routed to this page by default after login.</p>
  
  <p>Of course, if a user enters a specific account area URL such as  example.com/account/billing, they are taken to the billing page upon login (or directly, if already authenticated).</p>
  
  <p>However, if I click <a href="https://example.com/billing" rel="nofollow noreferrer">https://example.com/billing</a> in Excel or Word, I go to the default /account/services page (if authenticated; otherwise I go there after logging in). </p>
  
  <p>At first I believed this was because they are inserting hidden character(s) and thus invalidating the URL, causing our application to route the user to the default URL.</p>
  
  <p>So I tried these solutions:</p>
  
  <ul>
  <li><code>trim()</code> the URL</li>
  <li>Removing nonbreaking spaces: <code>$url = preg_replace('~\x{00a0}~','',$reqURL);</code></li>
  <li>function to remove byte order mark (sourced <a href="https://stackoverflow.com/a/15423899/5628323">here</a>)</li>
  </ul>
  
  <p>I've even copied test URLs from the browser into NPP and viewed as hex. There don't appear to be any extra characters.</p>
  
  <p>If I manually type the same URL into the browser bar, everything works perfectly. </p>
  
  <p>This is only happening for URLs which require authentication, public / frontend URLs seem unaffected. This lead me to <a href="https://superuser.com/questions/444984/excel-hyperlink-not-redirecting-properly-bug">this answer</a>, but I'm not sure it applies in our case. Microsoft is indeed running Microsoft Office Protocol Discovery before opening these URLs in the browser, but our authentication cookie is being recognized (the browser opens to the login page, but immediately redirects to the account area if the user has a valid cookie).</p>
  
  <p>Has anyone else experienced this? And what other causes could I look at?</p>