title: MediaWiki URLs with Anchors Truncate URL
body: <p>If I try to access a page on my MediaWiki, with a URL such as:</p>
  
  <p><a href="http://www.mywiki.com/some_page#a_section_of_some_page" rel="nofollow">http://www.mywiki.com/some_page#a_section_of_some_page</a></p>
  
  <p>the URL gets truncated to:</p>
  
  <p><a href="http://www.mywiki.com/some_page" rel="nofollow">http://www.mywiki.com/some_page</a></p>
  
  <p>I am running in IIS and using short URLs.  In my LocalSettings.php, I have</p>
  
  <pre><code>$wgScriptPath = "";
  $wgScriptExtension = ".php";
  $wgArticlePath = "${wgScriptPath}/$1";
  $wgServer = "https://www.mywiki.com";
  $wgUsePathInfo = false;
  </code></pre>
  
  <p>I have a rule in my web.config like this:</p>
  
  <pre><code>&lt;rule name="wwwroot"&gt;
     &lt;match url="^(.*)$" /&gt;
     &lt;conditions&gt;
        &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
        &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
     &lt;/conditions&gt;
     &lt;action type="Rewrite" url="index.php?title={UrlEncode:{R:1}}" /&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>I just wrapped the capture group in UrlEncode, but obviously it is not working.  Also, oddly enough in the blink of an eye when I click a external link to </p>
  
  <p><a href="http://www.mywiki.com/some_page#a_section_of_some_page" rel="nofollow">http://www.mywiki.com/some_page#a_section_of_some_page</a></p>
  
  <p>I can see the browser go to the correct page, but then "#a_section_of_some_page" gets stripped out of the URL and the browser redirects to the top level page.</p>