title: Wordpress .htaccess causing redirect loop
body: <p>I've been facing a problem with my WordPress app for over a month now and I couldn't make it work. I thought it was a problem with DNS server, then I thought I had a problem of caching, then a problem with the application (the wordpress redirecting it wrongly) and now I believe I have a problem with .htaccess</p>
  
  <p>If you go to www.porta8080.com.br my website work fine, but when I remove the WWW it makes a redirect loop. Somehow it is not changing the URL, so it reloads the page and it's redirected again and again and again. I checked with cURL and same happens.</p>
  
  <p>If I remove the .htaccess and change the permalinks settings to Query Strings it works. But anything that relies on URL rewriting (friendly URLs and stuff like that) fail. </p>
  
  <p>Since I'm using OpenShift I think my conditions and rules are wrong. I'm using the default WP .htaccess and I added some things to force the WWW</p>
  
  <p>This is my htaccess at the moment</p>
  
  <pre><code>RewriteBase /
  
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
  
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  </code></pre>