-1

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 www.website.comand 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 HTTP://WWW

website: http://www.porta8080.com.br

@edit

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.

Victor Ferreira
  • 135
  • 1
  • 1
  • 5

1 Answers1

0

You could try setting your A record to a 3rd party 301-www host

1) Do it with CloudFlare

2) use a 301-www IP 208.43.88.227 from Duda = porta8080.com.br IN A 208.43.88.227

3) check your .htaccess and post it here

4) Also check out the Wordpress community.

Jacob Evans
  • 7,886
  • 3
  • 29
  • 57
  • i Don't have a unique IP with OpenShift it's shared I suppose, or it can change any day. I just add this `RewriteCond %{HTTP_HOST} ^porta8080.com.br$ RewriteRule (.*) http://www.porta8080.com.br:80/$1 [R=301,L]` to my htaccess right after `RewriteEngine On` and check it again... same problem (solution from the link at wordpress community you posted) – Victor Ferreira Sep 25 '15 at 03:48
  • the IP address I gave you ONLY DOES 301 to www, nothing else, I'm actually researching anycast vps, I may just host one for people to use. – Jacob Evans Sep 25 '15 at 03:54
  • @VictorFerreira Op1(edited) may be what you want. – Jacob Evans Sep 25 '15 at 04:02