Reputation: 29
I installed wordpress in an OpenShift free small gear. Excited and trying things out. so my installation can be reached at wpapp-wpapp.rhcloud.com and it works fine. I added another alias there such as mydomain.com (no www in front). Now in my DNS I have my @ host name pointing to wpapp-wpapp.rhcloud.com as CNAME and www host name is pointing to mydomain.com (no www in front) as URL Redirect since I want www.mydomain.com to go to mydomain.com. All this is working fine.
The question is when I place in address bar wpapp-wpapp.rhcloud.com it still goes to wpapp-wpapp.rhcloud.com. Can I make wpapp-wpapp.rhcloud.com go to mydomain.com. Is this even possible? Thank you.
Upvotes: 0
Views: 1042
Reputation: 2093
You can do this via .htaccess.
Edit .openshift/config/.htaccess
, adding the block starting with "Redirect any host that is...":
RewriteEngine on
# Uncomment the following lines to force HTTPS
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
# Redirect any host that is not example.com to example.com
RewriteCond %{HTTP_HOST} !^example\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://example.com/$1 [L,R]
# WordPress Defaults
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
See the Apache URL Rewriting Guide for more info on .htaccess re-writes.
Upvotes: 2