title: .htaccess rewrites a little sluggish
body: <p>I have the following <code>.htaccess</code> code that tells the server to point certain sub domains to to a sub folder and then also handles the rewriting of the root domains. </p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  Options +FollowSymLinks
  RewriteEngine On
  
  ErrorDocument 404 ./404.php
  
  RewriteCond %{HTTP_HOST} ^secretplace\.testwebsite\.local
  RewriteRule ^(.*)$ /secretplace/$1 [P,NC,QSA]
  
  RewriteCond %{HTTP_HOST} ^payment\.testwebsite\.local
  RewriteRule ^(.*)$ /payment/$1 [P,NC,QSA]
  
  RewriteCond %{HTTP_HOST} ^login\.testwebsite\.local
  RewriteRule ^(.*)$ /login/$1 [P,NC,QSA]
  
  RewriteCond %{HTTP_HOST} ^signup\.testwebsite\.local
  RewriteRule ^(.*)$ /signup/$1 [P,NC,QSA]
  
  RewriteCond %{HTTP_HOST} ^fbauth\.testwebsite\.local
  RewriteRule ^(.*)$ /fbauth/$1 [P,NC,QSA]
  
  RewriteCond %{HTTP_HOST} ^masterapi\.testwebsite\.local
  RewriteRule ^(.*)$ /masterapi/$1 [P,NC,QSA]
  
  RewriteCond %{HTTP_HOST} ^www\.testwebsite\.local$ [NC]
  RewriteRule ^(.*)$ http://testwebsite.local/$1 [R=301,L]
  
  RewriteCond %{HTTP_HOST} !^testwebsite\.local$ [NC]
  RewriteRule ^(.*)$ /account_redirect/$1 [P,NC,QSA]
  
  RewriteCond %{HTTP_HOST} ^testwebsite\.local$ [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ref_([a-zA-Z0-9-]+)/?$ index.php?ref=$1 [L,QSA]
  RewriteRule ^api/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ api.php?function=$1&amp;method=$2&amp;extra=$3 [L,QSA]
  RewriteRule ^api/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ api.php?function=$1&amp;method=$2 [L,QSA]
  RewriteRule ^api/([a-zA-Z0-9-]+)/?$ api.php?function=$1 [L,QSA]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ $1-$2.php [L,QSA]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [L,QSA]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>It works, but on my local apache install the page loading is real sluggish. It takes a few seconds just to switch between pages.</p>
  
  <p>Just so you know the very last line of code allows me to remove the .php extension from pages. So instead of <code>http://testwebsite.local/features.php</code>, it loads <code>http://testwebsite.local/features/</code>.</p>
  
  <pre><code>RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [L,QSA]
  </code></pre>
  
  <p>Is there something obvious in my code that I'm doing wrong? I'm not quite sure how to debug .htaccess.</p>