title: mod_rewrite to pass date to file
body: <p>I have a file <code>http://sub.domain.com/apush/noteGetter.php</code> that handles dates in the format <code>d-m-y</code> through <code>noteGetter.php?date=d-m-y</code>. For example, I'll use January 13th, 2017. I want the url to be <code>http://sub.domain.com/apush/notes/2017/01/13</code>. I know this can be accomplished using mod_rewrite through htaccess, but I have little experience with regular expressions and even less with htaccess. What rules and conditions would I need to add to get this URL rewritten?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Current 'apush' directory <code>.htaccess</code></p>
  
  <pre><code>RewriteEngine on
  RewriteRule ^notes/(\d{4})/(\d{2})/(\d{2})$ "noteGetter.php?date=$3-$2-$1"
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^.]+)$ $1.php [L]
  DirectoryIndex home.php
  ErrorDocument 404 'https://www.domain.com/404'
  </code></pre>
  
  <p>Current 'root' directory <code>.htaccess</code></p>
  
  <pre><code>AuthType Basic
  AuthUserFile /home/tsenter/sub.domain.com/.htpasswd
  AuthName "Members Area"
  require valid-user
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^notes/(\d{4})/(\d{2})/(\d{2})$ "noteGetter.php?date=$3-$2-$1"
  RewriteRule ^([^\.]+)$ $1.php [NC,L]
  DirectoryIndex home.php
  ErrorDocument 404 'https://www.domain.com/404'
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <p>New 'apush' directory <code>.htaccess</code></p>
  
  <pre><code>RewriteEngine on
  RewriteRule ^notes/(\d{4})/(\d{2})/(\d{2})$ "noteGetter.php?date=$3-$2-$1"
  </code></pre>
  
  <p>New 'root' directory <code>.htaccess</code></p>
  
  <pre><code>AuthType Basic
  AuthUserFile /home/tsenter/sub.domain.com/.htpasswd
  AuthName "Members Area"
  require valid-user
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^\.]+)$ $1.php [NC,L]
  DirectoryIndex home.php
  ErrorDocument 404 'https://www.domain.com/404'
  </code></pre>