Welcome to the staging ground for new communities! Each proposal has a description in the "Descriptions" category and a body of questions and answers in "Incubator Q&A". You can ask questions (and get answers, we hope!) right away, and start new proposals.
Are you here to participate in a specific proposal? Click on the proposal tag (with the dark outline) to see only posts about that proposal and not all of the others that are in progress. Tags are at the bottom of each post.
How do I configure Cloudflare to redirect my alternate domain name with HTTPS support? Question
I have several alternate domain names that I would like to redirect to my site:
-
misspelling.example
->example.com
-
longer-domain-with-hyphens.example
->example.com
-
old-brand.example
->example.com
I've tried several redirect services and most don't support HTTPS. If I use them and visit https://misspelling.example/
I get either a security error because of a bad certificate, or they just don't connect at all.
I've heard that Cloudflare offers domain redirects that support HTTPS in their free service tier. Is that true? If so, how do I set it up?
1 answer
Cloudflare lets you add many domains and each will get their own free tier of service. Here is a screenshot of my Cloudflare account. Each of those domains is an alternate domain that has been configured to redirect:
After you add your domain to Cloudflare, you need to go into the DNS Records for that domain.
- Cloudflare will tell you two
NS
records. You need to log into your domain registrar and set these two values as theNS
records for your domain within your domain registrar. This will establish Cloudflare as our DNS host for that domain. - In Cloudflare, you need to add two
A
records for domain, one for the domain apex (no subdomain) and the other for the wildcard subdomain (*
). The IP address you set for the origin server doesn't matter much, because Cloudflare itself will handle all requests for this domain. I use1.1.1.1
. Both records need to be set as "Proxied" which sets them up to be served by Cloudflare's web servers.
Then you need to edit the "Page Rules" for the domain in Cloudflare. Create a rule to redirect *alternate-domain.example/*
to https://$1main-domain.example$2
or https://main-domain.example/$2
. $1
and $2 are variables that correspond to the first and second wildcards (*) respectively. The variant with
$1` will preserve the subdomain with the redirect, and the version without the `$1` will remove the subdomain.
It may take a few hours for everything to settle:
- The
NS
records for your alternate domain need to propagate. - Cloudflare needs to validate that you have changed your
NS
records to point to them. - Cloudflare needs to create a TLS security certificate for your domain so that HTTPS traffic works.
All of those things should happen automatically. After a little while you should be able to visit http://alternate-domain.example/
and https://alternate-domain.example/
to get redirected to your main domain.
1 comment thread