title: Hash fragment conflicting with server side code
body: <p>I have a website where the user chooses a series of letter and numbers and it takes them to a new page based on that.</p>
  
  <p>So it may take them to <code>/cds/C_1_3_A_2</code></p>
  
  <p>There is no actual <code>C_1_3_A_2</code> page in the <code>cds</code> directory, I have a rewrite rule:</p>
  
  <pre><code>RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^cds/(.*) /cds/index.html [L]
  </code></pre>
  
  <p>So that if the requested file doesn't exist, it gets rewritten to <code>index.html</code>, where a php script gets the last component of the URL (<code>C_1_3_A_2</code>) and it loads the relevant content, if the last component of the URL is <code>/cds</code> then the PHP script redirects to <code>/cds/C_1_1_A_1</code></p>
  
  <p>However I would like to add AJAX to make it smoother, which means I need to add support for hash fragments as older browser don't support history.pushState.</p>
  
  <p>So if the user goes by themselves to <code>/cds/#C_1_3_A_2</code>, it should be the same as <code>/cds/C_1_3_A_2</code></p>
  
  <p>But as the fragment doesn't get sent to the server, the user ends up as  <code>/cds/C_1_1_A_1#C_1_3_A_2</code>, and gets the content relevant to <code>C_1_1_A_1</code>, not <code>C_1_3_A_2</code> as they intended.</p>
  
  <p>As the PHP is server side, it executes before the Javascript could take care of the fragment, and I'd prefer not to have the user redirected by the PHP script and then back by the javascript.</p>
  
  <p>So how can I add support for hash fragments? How do other sites deal with this?</p>