Marco
Marco

Reputation: 1652

OpenShift and redirect in .htaccess

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.

Upvotes: 0

Views: 711

Answers (2)

fberci
fberci

Reputation: 91

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

Upvotes: 1

Pavel
Pavel

Reputation: 91

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]

Upvotes: 0

Related Questions