title: mod_rewrite redirect any instance of index.php to root of directory index.php
body: <p>What I want to achieve:</p>
  
  <ul>
  <li>alias/index.php?"anything here" works all the time</li>
  <li>alias/"any directory"/index.php redirects to alias/index.php</li>
  <li>"any file.php" redirects to alias/index.php</li>
  <li>alias/"any directory"/"any file.php" redirects to alias/index.php</li>
  </ul>
  
  <p>Only want to be able to execute index.php from root of alias directory</p>
  
  <p>Tried:</p>
  
  <pre><code>RewriteCond %{REQUEST_FILENAME} !index.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ https://&lt;host&gt;:&lt;port&gt;/&lt;alias&gt;/index.php [NC,R,L]
  </code></pre>
  
  <p>This doesn't redirect index.php in any sub directories to alias/index.php</p>