title: Redirect Loop error when wordpress is installed to a folder
body: <p>I have a website built on PHP on the base domain. I have installed a wordpress blog on /blog. For SEO purposes, I have done canonical redirection on the base domain with the code </p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^domainname\.com
  
  RewriteRule ^(.*)$ http://www.domainname\.com$1 [L,R=301]
  </code></pre>
  
  <p>However this creates a redirect loop when I try to access www.domainname.com/blog. The base website works as expected without any issues. The htaccess file associated with wordpress is </p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /blog/
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /blog/index.php [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>Since canonical redirection is essential for SEO, I need to have that code for the base domain. How can the blog issue be rectified while still making the canonical redirections work? Any insights will be helpful. Thanks in advance.</p>