大网数据广告活动
网站运营与故障问答

Configure 3 domains in CloudFlare, with 2 redirecting to the first one, for a wordpress installation in openshift

· 52CE 我爱测

My friend has 3 domains: example.com example.com.cc example.com.co The website is hosted at OpenShift and it's already redirecting example.com to it (using the guide in this answer ). So far, so good. We are using CloudFlare in t…

问题原文

原帖链接 · Somebody still uses you MS-DOS · CC BY-SA 3.0

My friend has 3 domains:

  • example.com
  • example.com.cc
  • example.com.co

The website is hosted at OpenShift and it's already redirecting example.com to it (using the guide in this answer). So far, so good. We are using CloudFlare in this setup.

We would like to know how to configure the other domains to redirect to the .com, using only CloudFlare, for a wordpress installation in openshift.

All nameservers have been changed at the domain registrars, and are set up to be used by CloudFlare to redirect to the .com, but I don't know exactly what I need to do. All the www. subdomains would be redirected to example.com as well.

There's a similar question here but the solution is to use the hosting control panel, something I don't want to do. My idea here is to use only CloudFlare, since for each domain a different registrar was used, and having all DNS configuration in a single place is better.

已采纳解答

原帖链接 · Somebody still uses you MS-DOS · CC BY-SA 3.0

Although matts answer gave me some direction for the "page rule" tip in cloudflare, a bunch of stuff still had to be made.

I'm assuming you already have an application running in openshift: let's suppose it's subdomain is php-example.rhcloud.com, and now you want to add custom domains example.com, example.com.cc and example.com.co to redirect to the application: remember that example.com.cc and example.com.co will redirect to example.com.

1 - Configure domain aliases for example.com, example.com.cc and example.com.co in the openshift web console;

2 - Create a Cloudflare account, adding example.com, example.com.cc and example.com.co as your domains;

3 - Go to your domain registrar (I'm using GoDaddy) and change the nameservers to the ones that were given to you when you were adding the domains in cloudflare (in my case it was alec.ns.cloudflare.com and june.ns.cloudflare.com);

4 - "Refresh" your domains in cloudflare, in the "Overview" section to check that cloudflare is now in charge of your DNS;

5 - Time to configure the DNS and Page Rules for your domains:

example.com

DNS

Type: CNAME Name: example.com Value: php-example.rhcloud.com

Type: CNAME Name: www Value: example.com

PS: Remember to check the cloud icon, it needs to be orange.

Page Rules

www.example.com/* Forwarding URL - 301 http://example.com/$1

example.com.cc

DNS

Type: CNAME Name: example.com.cc Value: php-example.rhcloud.com

Type: CNAME Name: www Value: example.com.cc

PS: Remember to check the cloud icon, it needs to be orange.

Page Rules

www.example.com.cc/* Forwarding URL - 301 http://example.com/$1

example.com.cc/* Forwarding URL - 301 http://example.com/$1

example.com.co

DNS

Type: CNAME Name: example.com.co Value: php-example.rhcloud.com

Type: CNAME Name: www Value: example.com.co

PS: Remember to check the cloud icon, it needs to be orange.

Page Rules

www.example.com.co/* Forwarding URL - 301 http://example.com/$1

example.com.co/* Forwarding URL - 301 http://example.com/$1

That's it: when you use https, an invalid certificate will issue because you're using a custom domain (example.com) but the certificate is for php-example.rhcloud.com: for you to use custom ssl certificates on the server, you need Bronze or Silver plan from openshift or use Cloudflare certificate.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-06-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。