title: How to redirect all existing .php files with exceptions in .htaccess
body: <p>My current .htaccess :</p>
  <pre><code>RewriteEngine On
  RewriteBase /
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . redirect1.php [L]
  </code></pre>
  <p>With this setting, users can still access the original <code>.php</code> files without going through <code>redirect1.php</code> which is undesirable. So I would like to send all requests for existing <code>.php</code> and <code>.html</code> files to a separate file, lets say <code>redirect2.php</code> which would check if the user is an admin.</p>
  <p>However, this would restrict the users from sending ajax requests to any php file, so there should be an exception for those. Maybe if the file is called <code>file.script.php</code> it should also be ignored.</p>
  <p>To summarize:</p>
  <pre><code>Existing .php &amp; .html     -&gt;  redirect2.php
  Existing .script.php      -&gt;  NO REDIRECT
  Any other existing file   -&gt;  NO REDIRECT
  Non existing file         -&gt;  redirect1.php
  </code></pre>