Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Incubator Q&A

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.

How do I configure Cloudflare to redirect my alternate domain name with HTTPS support? Question

+1
−0

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?

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Cloudflare-specific problem (2 comments)

1 answer

+1
−0

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:

Cloudflare account websites

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 the NS 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 use 1.1.1.1. Both records need to be set as "Proxied" which sets them up to be served by Cloudflare's web servers.

Cloudflare DNS records for redirecting domains

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.

Cloudflare page rules for redirecting domain

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.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »