Custom DNS zone templates are stored in /var/cpanel/zonetemplates/. Edit them in WHM under DNS Functions » Edit Zone Templates.
Where the files are
| Path | What it holds |
|---|---|
/var/cpanel/zonetemplates/ | Your custom templates. WHM saves them here the first time you edit a template. |
/var/cpanel/zonetemplates/reseller_standard and similar | Templates a reseller created, with the reseller's user name as a prefix. |
/usr/local/cpanel/etc/zonetemplates/ | cPanel's own default templates. Don't edit these: cPanel updates overwrite them. |
List the custom templates on your server:
ls -l /var/cpanel/zonetemplates/
If the folder is empty or missing, nobody has edited a template yet, and cPanel uses its defaults.
The three templates
| Template | Used for |
|---|---|
simple | Domains with only an A record |
standard | Domains on a dedicated IP address, addon domains and parked domains (aliases) |
standardvirtualftp | Domains on the shared IP address, which is most new accounts |
Edit a template in WHM
Log in to WHM as root and go to DNS Functions » Edit Zone Templates.
Click the template you want to change, usually standardvirtualftp for normal accounts.
Add or change records. Use the variables below instead of fixed values, so each new zone gets its own domain and IP.
Click Save.
Editing in WHM is safer than editing the files by hand. If you do edit a file over SSH, make a copy first:
cp -a /var/cpanel/zonetemplates/standardvirtualftp /root/standardvirtualftp.bak
Variables you can use
| Variable | Replaced with |
|---|---|
%domain% | The domain name |
%ip% | The domain's IPv4 address |
%ipv6% | The domain's IPv6 address |
%ftpip% | The IP address of the domain's FTP server |
%maildomain% | The mail server hostname for the domain |
%nameserver% to %nameserver4% | The first to fourth nameserver |
%nameservera% to %nameservera4% | The IP addresses of those nameservers |
%rpemail% | The contact email address of the zone |
%serial% | The zone's serial number |
%ttl% and %nsttl% | The default TTL and the nameserver TTL |
%reseller% | The reseller who owns the domain |
%cpversion% | The cPanel & WHM version |
Examples
Give every new domain an extra subdomain record. This line at the end of the template points dev. of each new domain to the domain's own IP address:
dev.%domain%. IN A %ip%
Use a shorter default TTL. Near the top of the template, replace $TTL %ttl% with a fixed value in seconds, for example:
$TTL 3600
Test a change by creating a test account or addon domain, then check its zone in DNS Functions » Edit DNS Zone, or from SSH:
dig @127.0.0.1 dev.example.com A +short
It should print the IP address of the new domain.
Common problems
My existing domains didn't change
That's expected: templates only affect new zones. Change existing zones in DNS Functions » Edit DNS Zone (or the customer's Zone Editor in cPanel), or reset a zone with DNS Functions » Reset a DNS Zone. Resetting removes any records that were added by hand.
TXT or DMARC records from the template are missing in new zones
cPanel has reported a known issue where TXT records from the template aren't used for new accounts, and new domains get cPanel's default DMARC record instead of the one in the template. If that happens on your version, add these records per domain in Edit DNS Zone, and check the cPanel release notes for a fix.
Records like webmail, cpanel or autodiscover aren't in the template
cPanel adds those service subdomains separately. Turn them on or off in Server Configuration » Tweak Settings (search for "service subdomains").
The custom zones are gone after moving accounts to a new server
Zone templates are not copied when you transfer accounts. Copy the files in /var/cpanel/zonetemplates/ to the new server, or recreate the templates there in WHM.
Related articles
- Install cPanel & WHM on AlmaLinux
- Change the hostname of a Linux server
- Free SSL for the server hostname and sites in WHM (AutoSSL)
Still stuck? Open a support ticket and we'll help.