title: Rewriting a URL only if a filetype is not specified in the request
body: <p>I am currently using the following .htaccess on a site:</p>
  
  <pre><code>RewriteEngine On
  
  RewriteCond %{REQUEST_URI} ^/$
  RewriteRule (.*) /home [R=301]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^\.]+)$ $1.php [NC,L]
  </code></pre>
  
  <p>It works fine, and redirects URLs such as <code>www.test.com/page2</code> to <code>www.test.com/page2.php</code>.</p>
  
  <p>However, I have a couple of files I would like site users to be able to download, and I've just realised that the rewrite rules are changing requests like <code>page2/file.pdf</code> to <code>page2/file.pdf.php</code>, which of course returns a 404. </p>
  
  <p>How can I modify the rules to request a <code>.php</code> file only if another filetype hasn't been specified in the request?</p>