Multiple domain name support for a website
Note
This guide describes how to set up support for a website's primary domain name and its subdomainexample.com
and www.example.com
.
To set up an additional domain, e.g, example2.com
, create a bucket with the same name. Next, configure hosting for this bucket and specify the parameters for redirects to the primary domain.
To enable multiple domain name support for your website, e.g., example.com
and www.example.com
:
-
Create a bucket. Give it one of the domain names, e.g.,
www.example.com
. -
Configure the bucket as hosting.
-
Link the domain name, e.g.,
www.example.com
, and the bucket. -
On the DNS server, add another resource record to link one more domain name, e.g.,
example.com
, and the bucket:This option is available for buckets with a dot in their name, e.g.,
example.com
.Yandex Cloud DNSThird-party DNS serverCreate a resource record in Cloud DNS with the following parameters:
Name Type TTL Value example.com. ANAME 600 www.example.com.website.yandexcloud.net ANAME records enable using second-level domains for hosting. Unlike CNAME records, they do not restrict the use of other record types in the same zone.
Updating resource records may take a while.
An example of a CNAME resource record looks like this:
example.com CNAME www.example.com.website.yandexcloud.net
To use a CNAME resource record, make sure your domain name belongs to at least a third-level domain. This restriction is due to the way CNAME records are handled on DNS hosting platforms. For more information, see RFC 1912
, section 2.4.Updating resource records may take a while.
If for some reason you cannot or do not want to create another resource record, you can do the following:
- Create a VM with a public IP address.
- Link
example.com
to the VM public IP address. - Set up all required aliases on the DNS server side.
- Install a web server on the VM and configure a redirect to the Object Storage bucket.