wordpress 301 redirect .htaccess setting on openshift

I have just set up a wordpress blog on openshift.
Here is what i have done.

Created an alias abc.mydomain.com in openshift.

Read More

Cname abc.mydomain.com to myexampleapp.rhcloud.com.

Login to myexampleapp.rhcloud.com and change myexampleapp.rhcloud.com to abc.mydomain.com (Settings-general)

Here i want to do a 301 redirect through .htaccess.
What i want to achieve is when I input the following into browser address bar

  1. myexampleapp.rhcloud.com automatically redirect to abc.mydomain.com
  2. myexampleapp.rhcloud.com/hello-world/ automatically redirect to abc.mydomain.com/hello-world/

But it is not redirecting. (input myexampleapp.rhcloud.com/hello-world/ in browser address bar and it changes to abc.mydomain.com/hello-world/ automatically)
I have been searching a lot for the code
Here is what i have put in htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^myexampleapp.rhcloud.com [NC]
RewriteRule ^(.*)$ http://abc.mydomain.com/$1 [L,R=301]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Not working at all. What should be the exact code to make that redirect happen?

Related posts