title: Using RewriteCond with %{REQUEST_URI} for mod_rewrite
body: <p>I would like the URL:</p>
  
  <pre><code>http://domain.com/category/subcategory/title
  </code></pre>
  
  <p>To point to:</p>
  
  <pre><code>http://domain.com/posts/category/subcategory/title.php
  </code></pre>
  
  <p>My .htaccess file looks like this:</p>
  
  <pre><code>RewriteEngine on
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{QUERY_STRING} !^.+
  #RewriteCond post/%{REQUEST_URI}.php -f
  RewriteRule ^(.*)$ post/$1.php [L]
  </code></pre>
  
  <p>This works however when I uncomment the line above it does not work.</p>
  
  <p>I have tried:</p>
  
  <pre><code>RewriteCond /post/%{REQUEST_URI}.php -f
  RewriteCond post/%{REQUEST_URI}.php -f
  RewriteCond post%{REQUEST_URI}.php -f
  </code></pre>
  
  <p>None of these work. What am I doing wrong?</p>
  
  <p>Also is there an easy way to debug these rules? Like console logging variables or something?</p>