I’m using Netlify’s built in DNS tools, but I can’t figure out how to create a subdomain which then redirects it to an external site.
I need subdomain.mydomain.com
to redirect to an external site https://externalsite.com
- in other words, basic site forwarding on the subdomain level.
In this case it’s community.mydomain.com
to go to an external discussion tool with a domain that I do not control.
Do I create a netlify.toml
file or _redirects
file or something of that nature?
I tried creating an CNAME alias in Netlify’s DNS and it defaulted to my-site.netlify.app
and I couldn’t edit the forwarding there.
Do I create the CNAME alias and then come up with a _redirects
file?
If so, I’ll need basic instructions to set this up. I’m still new. Thanks in advance!
If you are using Netlify DNS and wish to add a subdomain that points to a non-Netlify site you don’t use either the netlify.toml
or _redirects
to configure it. You need to add it under https://app.netlify.com/teams/[YOUR-TEAM-NAME]/dns
.
If you attach the subdomain to a Netlify site and wish it to redirect to another location, you then add this to either a netlify.toml
or _redirects
file
@jasiqli can you please provide directions on what type of record and values to add once I get to the DNS page?
I tried both a CNAME and Alias and neither of them are forwarding.
Here’s what I put:
Record Type: Alias
(also tried CNAME
)
Name: community
Value: external-site.com
What am I missing here? Thanks!
Netlify DNS doesn’t offer the ability to forward. (And no, Alias and CNAME records are not used for that purpose. See Netlify Supported record types documentation and this article for an explanation of DNS record types.)
As you wish to have the subdomain act as a forwarder only and you are using Netlify DNS you will need to add the subdomain to a live site on Netlify as a custom domain. Once you have done this, add a redirect to a _redirects
file in the form of
# [YOUR-SUBDOMAIN] [WHERE-YOU-WANT-IT-TO-FORWARD-TO]
https://subdomain.example.com https://www.example.net
2 Likes
@jasiqli getting closer…but now I’m getting ERR_SSL_VERSION_OR_CIPHER_MISMATCH
in the browser 
My Netlify DNS has a CNAME with:
NAME mysubdomain.mydomain.com
VALUE externalsubdomain.externaldomain.com
and my _redirects
file reads:
/mysubdomain/* https://externalsubdomain.externaldomain.com/page/:splat 301!
and my SSL certificate in Netlify is properly setup as a wildcard to cover *.mydomain.com
The external site is hosted on https://notion.site so the SSL certificate should be valid and trustworthy.
I’m at my wits end…
What is the domain you are trying to configure?
With a CNAME the client (e.g. browser) will attempt to access mydomain.mydomain.com
and expect a certificate for that domain, but is actually getting a certificate for externalsubdomain.externaldomain.com
because a CNAME is NOT a redirect.
If you want a redirect do not use a CNAME. Instead create a manual deploy site at mysubdomain.mydomain.com
(in Netlify) and create a _redirects
file as @jasiqli suggested.
That is, point mysubdomain.mydomain.com
at your manual deploy site where you have the _redirects
file.
1 Like
@danielfdickinson1 that makes perfect sense, but still no dice.
I deleted the CNAME.
Then I set up a manual deploy site on my subdomain with a basic html page and _redirects
file, but now the redirect won’t engage…it just loads the new subdomain html site that I uploaded.
I have:
- A new manual deploy site at
mysubdomain.mydomain.com
with a _redirects
file in the root folder
- My primary manual deploy site at
mydomain.com
with a _redirects
file in the root folder
The _redirects
file in both places reads:
/mysubdomain/* https://externalsubdomain.externaldomain.com/page/:splat 301!
Thanks for your patience with me!
should be
EDIT (should be 301! not just 301)
https://mysubdomain.mydomain.com/* https://externalsubdomain.externaldomain.com/page/:splat 301!
1 Like
You may want to include the http
version as well.
1 Like
It works!! 
@danielfdickinson1 @jasiqli you may now have a
for your good deeds.
I just had to use a root wildcard on the subdomain.
The working _redirects
file reads:
/* https://externalsubdomain.externaldomain.com/page/:splat 301!
/* http://externalsubdomain.externaldomain.com/page/:splat 301!
2 Likes
Since you have used a root wildcard, I don’t think you need the second line (http
). I forgot that your subdomain was the primary domain not a secondary domain you can use the root wildcard.