title: .htaccess if request url different from host, redirect to CodeIgniter controller
body: <p>When somebody accesses my website <code>"example.com"</code> - (this website runs CodeIgniter), I want to be able to detect through .htaccess if that request is NOT <code>"example.com"</code>, if someone is accessing my website through <code>"user1.com"</code> (this should work as I have my virtual hosts to accept incoming requests if the CNAME is pointed), then they will be redirected to a controller.</p>
  
  <p>This is my attempt at trying:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  RewriteCond %{REQUEST_URI} !^/site/%1$1
  RewriteRule ^(.*)$ http://example.com/site/%1$1 [L,NC,P]
  </code></pre>
  
  <p>If possible, would I be able to keep the external request domain URL, so if the request is from <code>'user1.com'</code> it would be fine--basically no masking.</p>
  
  <p><strong>Site</strong> is the name of my controller and it takes a parameter name.</p>
  
  <p><strong>Problems</strong></p>
  
  <p>I think when using this way, the virtual host address doesn't work correctly, it doesn't show sub-pages...</p>