Custom domains
In order to use your own domain for your site, you just need to do two things:
- Add a
statichost.yml
configuration file (or edit your existing file) and add your domain via thedomains
property. - Add a
CNAME
DNS record from your domain toSITENAME.statichost.eu.
.
Note the dot at the end of the CNAME. The dot is technically required. However, some DNS providers do let you add a trailing dot. In this case, you can leave it out, and it should work correctly.
statichost.yml
domains:
# Primary domain
- www.example.org
# Domains that redirect to the primary
- example.org
The domains
property should be an array / list of strings. The first domain on
the list is the primary domain. All the other domains on the list will redirect
to the primary domain. Note that redirects will preserve the path URI for
the request. On this site, for instance,
https://statichost.eu/docs/routing/#rewrites-ie-proxying
will redirect to
https://www.statichost.eu/docs/routing/#rewrites-ie-proxying
.
Remember to add DNS records not only for your primary domain, but also all redirect domains.
You can add your domain(s) at any time to the configuration file - there is no
need to configure DNS beforehand. In fact, we recommend that you first add your
custom domains to the configuration file, build your site, and only after that
change your DNS settings. When we receive the first request using your custom
domain, we will create any SSL certificates and other configuration on-demand.
This ensures that there is no down-time while you switch to statichost.eu
.
Note that you need to build your site after making changes to domains in order for the changes to be picked up.
Root domains
If you want to use the root of a domain (e.g. example.org
) as either the
primary domain or a redirect domain, a CNAME
DNS record will not work. In
this case - for any root domains - either use an ALIAS
(or similar, depending
on your DNS provider) record, or add an A
record pointing to our main server
at 95.217.26.94
.