301 Redirect Loop

I think there is some issue with openshift’s php hosting.
I found this thread on stackoverflow.
So catch is you append port no after host.
This .htaccess code should work.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) http://www.example.com:80/$1 [R=301,L]