0

I have a Wordpress app deployed on OpenShift and a domain alias associated, i.e. www.example.org. Now I would like to add another alias, i.e. www.example2.org, and gracefully redirect all the request from www.example.org => www.example2.org. I tried to do this via .htaccess:

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

Whenever contact www.example.org it generates an infinite loop of redirects and I can not understand why.

Marco
  • 1,642
  • 3
  • 16
  • 29

2 Answers2

1

Openshift rewrites the redirect header, but you can prevent this by adding the port number to the URL. See more here.

Community
  • 1
  • 1
fberci
  • 91
  • 1
  • 4
0

There's no need for RewriteCond. And example.org is not an alias of example2.org. It's a brand new A record. You can eventually redirect www.example.org via your domain registrar's dashboard or create index.php with header('Location: http://www.example2.org');.

RewriteEngine on
RewriteRule ^(.*)$ http://www.example2.org/$1 [R,QSA,L]
Pavel
  • 81
  • 1
  • 7
  • www.example2.com and www.example.com are two CNAMEs pointing to the same openShift application, and they are both defined as alias on the app. In other words I simply want to change the application domain with graceful redirect from the old domain to the new domain. – Marco Dec 01 '14 at 16:59
  • Oh, now I see.. but still if sb types just "examples.org" he gets nowhere since it's A record and you never have a static IP address of your OpenShift app. – Pavel Dec 01 '14 at 22:09
  • #2 In my case I redirected (301) "example.org" to "example2.org" right away in the domain's administration. It seems to me as the only working solution. – Pavel Dec 01 '14 at 22:18