简体   繁体   中英

HTTP issue for custom domain

For my openshift non scalable app(free tier) custom URL www.mydomain.com work fine I add two alias www.mydomain.com and mydomain.com at openhift side and proper www CNAME records at GoDaddy dns control panel. But when user type http://mydomain.com or mydomain.com it doesn't work. I think this problem will solve by adding A(HOST) IP entry. I continously check my app IP address using ping for week, it remains same. My question is, is it good to use hardcoded IP. Is there is free third party service which automatically redirect user from http://mydomain.com to http://www.mydomain.com or Just hope user type www.mydomain.com

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

Use this htaccess, it will redirect non www to www & remember to change domain.com to your domain

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM