Skip to main content

How to add a subdomain?

This article explains how to create a subdomain (for example blog.example.com) for a domain that uses Openprovider DNS.

Question:

How do I add a subdomain to my domain in Openprovider?

Answer:

A subdomain is not a separate product that you order. You create it by adding a DNS record to the existing DNS zone of the domain, with the subdomain in the Name field.

You can add it in two ways:

  1. Via Reseller Control Panel (RCP)
  2. Via API

Before you start

  • The domain needs a DNS zone in Openprovider. If it has none yet, create one first: How to create a zone?
  • The domain must use the Openprovider nameservers. Only then are the records in the Openprovider zone live on the internet.
  • If the domain uses external nameservers (your hosting provider or another DNS provider), add the subdomain record there instead. Not sure which nameservers are set? See How to change nameservers of a domain.

Adding a subdomain via Reseller Control Panel (RCP)

  1. Go to DNS Management > Zone Overview.
  2. Search for the domain and open its DNS zone.
  3. Add a new record and fill in the fields:
    • Name: only the subdomain part, for example blog. Do not type the full domain, Openprovider adds it automatically.
    • Type: A to point the subdomain to an IPv4 address, AAAA for an IPv6 address, or CNAME to point it to another hostname.
    • Content: the IP address (A/AAAA) or the target hostname (CNAME).
    • TTL: choose one of the available values (15 minutes, 1 hour, 3 hours, 6 hours, 12 hours or 1 day). More about TTL here.
  4. Save the zone.

Your subdomain is now created. Not sure which record type you need? Have a look here!

Examples

For the domain example.com:

Subdomain you want

Name

Type

Content

blog.example.com

blog

A

192.0.2.10

blog.example.com (IPv6)

blog

AAAA

2001:db8::10

shop.example.com

shop

CNAME

shops.provider.example

www.example.com

www

CNAME

example.com

shop.eu.example.com

shop.eu

A

192.0.2.20

any.example.com (all subdomains)

*

A

192.0.2.10

The last row is a wildcard record. It catches every subdomain that has no record of its own. More about wildcards here.

Adding a subdomain via API

Use the zone update call and add the record with the subdomain in name. The example below adds blog.example.com as an A record:

curl -X PUT https://api.openprovider.eu/v1beta/dns/zones/example.com \
-H 'Authorization: Bearer <your token>' \
-H 'Content-Type: application/json' \
-d '{
"id": 6574389,
"name": "example.com",
"records": {
"add": [
{
"name": "blog",
"ttl": 3600,
"type": "A",
"value": "192.0.2.10"
}
]
}
}'

RESPONSE EXAMPLE

{
"code": 0,
"desc": "",
"data": {
"success": true
}
}
  • id is the ID of the zone, returned when you retrieve the zone.
  • Accepted ttl values: 900, 3600, 10800, 21600, 43200, 86400. Any other value is saved as 86400.

More examples (update and remove records): 3 Zones API: How to modify a zone.

Note

  • CNAME conflicts: a subdomain with a CNAME record cannot have any other record with the same name. To add a CNAME, first remove the other records for that subdomain. More information here.
  • No '@' symbol: for the root domain itself, leave the Name field empty. For a subdomain, enter only the subdomain part.
  • Nameservers for a subdomain: pointing a subdomain to other nameservers (NS records for a subdomain) is not available by default. Contact Support if you need this.
  • Server side: the DNS record only points the subdomain to a server. The website or service must also be set up for the subdomain on that server, for example at your hosting provider.
  • Not visible yet? DNS changes are cached by resolvers, so they are not visible everywhere straight away. See Why zone changes are not propagated across public DNS resolvers.