title: Modrewrite Works on localhost but not on server
body: <p>This isn't so much a question looking for a solution, rather a question looking for some clarification.</p>
  
  <p>A couple of days ago I was having a ton of trouble getting my mod_rewrites that worked fine on localhost (running XAMPP) to work on my production server (CentOs 6 LAMP stack).</p>
  
  <p>The rewrite looked like this:</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  
  RewriteRule ^my/page/([a-zA-Z0-9]+)$ /my/page/$1/
  RewriteRule ^my/page/([a-zA-Z0-9]+)/$ /my_page.php?t=$1
  </code></pre>
  
  <p>On localhost, the above line worked perfectly and performed the following:</p>
  
  <pre><code>my/page/ab123 --&gt; my_page?t=123
  </code></pre>
  
  <p>However, on my production server the above rule was having no effect. I'm extremely new to mod_rewrites and server architecture in general so finding the solution took me hours and hours. Now, I'd love to know why the below fixed my issue because I've honestly got no clue.</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  
  RewriteRule ^/my/page/([a-zA-Z0-9]+)$ /my/page/$1/
  RewriteRule ^/my/page/([a-zA-Z0-9]+)/$ /my_page.php?t=$1
  </code></pre>
  
  <p>It was a simple change. I had to add a forward slash before the page's name: <code>^/my/page</code></p>
  
  <p>I would like to be able to move my htaccess files to my server without always having to add this extra character. Is there a way around this?</p>
  
  <p>Also, the following options appear in my <code>httpd.conf</code> file</p>
  
  <pre><code>&lt;Directory /my/sites/directory&gt; 
          Options -Indexes +Multiviews +FollowSymLinks
          DirectoryIndex index.php index.html
          AllowOverride All
          Allow from all
  &lt;/Directory&gt;
  </code></pre>