title: Redirecting domain.com to www.domain.com
body: <p>I want to redirect all requests to <a href="http://domain.com" rel="nofollow">http://domain.com</a> to <a href="http://www.domain.com" rel="nofollow">http://www.domain.com</a>, hence I use the following .htaccess placed in the root of my site:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTP_HOST} ^domain\.com
  RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]
  </code></pre>
  
  <p>This works very nice, except in subfolders where I do some more URL rewriting:</p>
  
  <pre><code>RewriteEngine on
  RewriteBase /articles/
  RewriteRule ^(.+)$ index.php [L]
  </code></pre>
  
  <p>In fact nothing happens if I enter the URL: <a href="http://domain.com/articles/article.html" rel="nofollow">http://domain.com/articles/article.html</a>
  Expected behavior would be a redirect to <a href="http://www.domain.com/articles/article.html" rel="nofollow">http://www.domain.com/articles/article.html</a></p>
  
  <p>What would be the best way to achieve the result?</p>
  
  <p>Thanks</p>