title: Change page content according to what URL is used to access your domain
body: <p>For ex: My website is www.mydomain.com</p>
  
  <p>the only thing on the page is </p>
  
  <pre><code>&lt;h1&gt;Category&lt;/h1&gt;
  </code></pre>
  
  <p>When a user types in the url www.mydomain.com/sports I would like for the page www.mydomain.com to load (with or without the /sports path, preferably keeping the same URL the whole time) and know that the user accessed the page using the url www.mydomain.com/sports to get there. </p>
  
  <p>At which point, I could then use javascript to change </p>
  
  <pre><code>&lt;h1&gt;Category&lt;/h1&gt;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>&lt;h1&gt;Sports&lt;/h1&gt;
  </code></pre>
  
  <p>I am able to redirect the page www.mydomain.com/sports to www.mydomain.com, but when doing this the URL changes and I can't detect the page URL that was used initially to navigate there (www.mydomain.com/sports) using javascript: <a href="http://www.w3schools.com/jsref/obj_location.asp" rel="nofollow">http://www.w3schools.com/jsref/obj_location.asp</a> since it returns the new page URL without the path.</p>
  
  <p>Am hoping for a non PHP/.htaccess solution.</p>
  
  <p>UPDATE:</p>
  
  <p>I resorted to using htaccess to fix the problem, was easier than expected to implement.</p>
  
  <p>Here's what I used in case someone else finds this useful</p>
  
  <p>.htaccess file (upload to the directory on your site where you want it to be used, in my example, that would be the main directory)</p>
  
  <pre><code>&lt;ifModule mod_rewrite.c&gt;
  RewriteEngine On 
  RewriteBase / ****start at/find the root directory 
  RewriteRule ^(/sports|sports/)$ index.html [NC,L] ****find and clear index.html from URL if the extension is mydomain.com/sports or mydomain.com/sports/
  &lt;/ifModule&gt;
  </code></pre>