0

I have a Wordpress site hosted in Openshift and I have setup CloudFlare DNS service.I have added CNAME records in CloudFlare DNS management for both www.mydomain.com and mydomain.com. I have used CNAME records instead of A records because Openshift specifically says so. Both are aliases of myapp-myusername.rhcloud.com. Now I decided to change my domain to mydomain2 for SEO reasons. I repeated all the steps done previously for the second domain too.So I have 2 domains and their www subdomains, in CloudFlare pointing to myapp-myusername.rhcloud.com and 4 aliases in Openshift console. The issue is www.mydomain2.com gives me a redirect loop. People at CloudFlare has told me it is the issue from Openshift side. All the other three, mydomain.com,www.mydomain.com and mydomain2.com gives me the site without issues. The DNS resolution works fine which I verified by running host command. I am unable to figure out the reason for the issue.

joseph
  • 940
  • 10
  • 19
  • did you manage to find a definitive solution to this? even adding or removing WWW i am still redirected to the URL. – Victor Ferreira Jul 05 '16 at 18:20
  • I dont remember exactly. Apparently what I have answered is the only thing that worked out. – joseph Jul 07 '16 at 12:29
  • i had this problem a few times at least with two different projects. at the beginning I was ADDING WWW. but sometimes, after migrating the database or sending major updates it started the redirect loop. this last time when I was reading suggestions I did what you said and REMOVED the WWW. Didn't work. Tried adding again, and then I removed again and then it worked. I believe there is an issue with OpenShit + Cloudflare, maybe some sort of server cache that is causing this, and when you solve the problem you don't see the result immediately so you try to solve it again and undo the fix. – Victor Ferreira Jul 07 '16 at 14:23

1 Answers1

0

As a workaround I added the following redirect rule to the htaccess

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

Make sure you add the port address which I found out from this answer.

Community
  • 1
  • 1
joseph
  • 940
  • 10
  • 19