pepuch
pepuch

Reputation: 6516

Redirect domain to Openshift page

I want to redirect my domain.com to openshift page (openshift-app.rhcloud.com). I've done it as described here and it works. The only problem is that on any site I won't be the address will always be domain.com. For example:

openshift-app.rhcloud.com -> domain.com
openshift-app.rhcloud.com/site1 -> domain.com
openshift-app.rhcloud.com/site2/subsite1 -> domain.com

All of those sites will redirect to domain.com. Is there any possibility to redirect it in a 'normal' way where entire address will be shown?

Upvotes: 2

Views: 2605

Answers (2)

pepuch
pepuch

Reputation: 6516

I've finally resolved the problem. All I had to do:

Add aliases to openshift page (for www.mydomain.com and mydomain.com)

Add those rules to domain

mydomain.com.   A   <ip_address_to_openshift_page>
www             A   <ip_address_to_openshift_page>
mydomain.com.   NS  <dns_of_domain_provider>

For example (my domain is on linuxpl.com):

mydomain.com.   A   107.22.142.72
www             A   107.22.142.72   
mydomain.com.   NS  ns15.linuxpl.com.

Upvotes: 1

centum
centum

Reputation: 131

Add rule to .htaccess with 301 redirect for mod_rewrite:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^openshift-app.rhcloud.com$
RewriteRule (.*)$ http://www.domain.com/$1 [R=301,L]

Specifically for cartridge python-2.6 in folder ${OPENSHIFT_REPO_DIR}/wsgi/.htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ^openshift-app.rhcloud.com$
RewriteRule ^application/(.*)$ http://www.domain.com/$1 [R=301,L]

Upvotes: 2

Related Questions