There is this WordPress application on OpenShift that uses CloudFlare as DNS server.
OpenShift gives us a URL such as
app-user.rhcloud.com and allow you to add alias. Such as
website.com. So you have to add CNAME entries to your domain website.com pointing to app-user.rhcloud.com. My registrar didn't allow me to add CNAME without a subdomain (without www.) so I moved my DNS Servers to CloudFlare and added the CNAMEs there.
registrar -> CloudFlare -> OpenShift
The WordPress application has a .htaccess to rewrite URL and makes it more friendly. The application configuration is set up to redirect any to a ROOT URL, in my case, I choose to redirect to
http://www.website.com and this should work. But I started facing a redirect loop problem. I tried to do the redirect myself, at the first line of
index.php file, but it also failed. Then I stopped using the
Location in the headers to redirect and started with
Refresh. This was the most effective, but stops working in a few hours. Then I forced a no-cache version as explained here https://stackoverflow.com/questions/1907653/how-to-force-page-not-to-be-cached-in-php. Didn't work.
I started trying things with .htaccess, checking some rules and conditions to force the before the application tried to redirect, but it also causes the same loop. The URL never changes, both with .htaccess and with PHP.
I then tried the following: without rewriting URLs AND/OR with an empty .htaccess there is no friendly URL, but no redirect loop as well.
Any Ideas on how to solve this? It's been over 2 weeks since I started installing this app, and I have to point non-WWW requests to
Just to make it clearer: I can't add
HTTP://WWW to non-WWW urls, so it creates a redirect loop. When page is reloaded without the
http://www it makes the redirect AGAIN. And again and again. This is the real problem.