title: non-www to www redirect not working for articles in subdirectory installation of WordPress
body: <p>I am helping out with a website that has a main/root website as well as a WordPress installation in a sub-directory.  The .htaccess file of the main site has rules to redirect non-www traffic to www:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^site\.com [NC]
  RewriteRule (.*) http://www\.site\.com/$1 [R=301,L]
  </code></pre>
  
  <p>However, this has no effect on the WP site.  For instance:</p>
  
  <ul>
  <li>site.com would redirect to www.site.com</li>
  <li>site.com/some-content-belonging-to-root-site would redirect to www.site.com/some-content...</li>
  <li>site.com/wordpress does not redirect to www.site.com/wordpress</li>
  </ul>
  
  <p>I added similar rules to the WordPress .htaccess, playing around to try to get the result I would expect, but the best I could come up with is this:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^site\.com [NC]
  RewriteRule (.*) http://www\.site\.com/wordpress/$1 [R=301,L]
  </code></pre>
  
  <p>...which successfully redirects site.com/wordpress to www.site.com/wordpress, but does not redirect site.com/wordpress/a-blog-post.</p>
  
  <p>I feel like I must be missing something simple or obvious, but hours of experimentation and research have not yielded a thing except that .htaccess files in sub-directories are not advised (but I think this is unavoidable in this case).</p>
  
  <p>I would be grateful for any suggestions on how to fix the rewrite condition or rule to successfully redirect the post links of the WP site.</p>
  
  <p>Thanks!</p>
  
  <p>EDIT / ADDITIONAL INFO: I modified the RewriteCond to better match the incoming URLs, thinking that this might help, but it has the same effect.  The base wordpress URL is rewritten, but article URLs are not:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST}/wordpress/.* ^site\.com/wordpress/.* [NC]
  RewriteRule (.*) http://www\.site\.com/wordpress/$1 [R=301,L]
  </code></pre>
  
  <p>I wouldn't think that it should matter, but just in case, I'll mention that the article URLs look like this:
  site.com/wordpress/2014/05/16/article-slug</p>