Final Instructions So You Don’t Have To Wade Through Everything Above
If you have custom domain example.com
that you want to point to example.glitch.me
, here’s what to do:
- Add
example.com
andwww.example.com
as custom domains in Glitch. The order doesn’t matter.
Glitch config example screenshot
-
Go to Domain Settings for
example.com
at your registrar. For Namecheap, choose “Namecheap BasicDNS”. Delete any existing domain redirects. -
Go to Advanced DNS settings (as it’s called in Namecheap) and delete any existing records.
-
Add an A Record with host
@
(meaning the root aka apex domain –example.com
) and value50.31.246.2
(the IP address for glitch.edgeapp.net – but check this with any dnslookup or ping service – it has changed before and everything breaks when it does, frustratingly). When testing and changing things, set the TTL to 1 minute. If you expect it to be stable, “Automatic” should be fine. -
Add a CNAME record with host
www
and valueexample.com
. Same story with the TTL. (Note that Namecheap automatically turnsexample.com
intoexample.com.
with a trailing dot, which is expected.)
-
It normally will work now, within like a minute. If it doesn’t, check https://dnspropagation.net/A/example.com to see if the DNS records are propagating. If it doesn’t start working in 3 days then you can definitively rule out “slow DNS propagation” as the culprit.
-
For SEO reasons you want search engines to know which of the URL variants is the canonical one. This is called URL canonicalization aka “rel canonical”. Namely, pick a variant – let’s say
https://www.example.com
– as the canonical version of the URL and specify it in the header of the HTML like so:
<head>
...
<link rel="canonical" href="https://www.example.com"/>
...
</head>
That way search engines will not be confused and penalize you for having seemingly the same content duplicated across 4 (actually 6, counting http://example.glitch.me
and https://example.glitch.me
) different URLs.
- Redirect http to https. Doing this server-side is ideal, see full instructions, but for a static site, you can put the following in index.html:
<script>
if (window.location.protocol === 'http:')
window.location.replace('https'+window.location.href.slice(4))
</script>