Record Examples

TXTDirect is using DNS TXT records to store data and keeps you in control of your own data.

In the examples “txtdirect.example.com” is your hosted TXTDirect instance.

It is recommended to use CNAMEs to reference this instance, where possible.

These are simplified examples.
For an overview of the full TXT record configuration take a look at our specification.

Host

Host Type

Host redirect using default redirection code
example.com -> about.example.com 301

example.com                   3600 IN A      127.0.0.1
_redirect.example.com         3600 IN TXT    "v=txtv0;to=https://about.example.com;type=host"

Host redirect using explicit 301 redirection code
www.example.com -> about.example.com 301

www.example.com               3600 IN CNAME  txtdirect.example.com.
_redirect.www.example.com     3600 IN TXT    "v=txtv0;to=https://about.example.com;type=host;code=301"

Host redirect using explicit 302 redirection code
www.example.com -> about.example.com 302

www.example.com               3600 IN CNAME  txtdirect.example.com.
_redirect.www.example.com     3600 IN TXT    "v=txtv0;to=https://about.example.com;type=host;code=302"

Host redirect using placeholder
example.com -> about.example.com 301

example.com                   3600 IN A      127.0.0.1
_redirect.example.com         3600 IN TXT    "v=txtv0;to=https://about.example.com{uri};type=host"

Host redirect using multiple placeholders
placeholder.example.com/cat.png -> example.com/cat.png

placeholder.example.com              3600 IN CNAME  txtdirect.example.com.
_redirect.placeholder.example.com    3600 IN TXT    "v=txtv0;to=https://example.com/{path}{file};type=host"

Path

Path Type

Path redirect using default ordering
example.com/firstMatch/secondMatch -> about.example.com example.com/firstMatch/noMatch -> fallback or 404

example.com                                   3600 IN A      127.0.0.1
_redirect.example.com                         3600 IN TXT    "v=txtv0;type=path"
_redirect.secondmatch.firstmatch.example.com  3600 IN TXT    "v=txtv0;to=https://about.example.com/;type=host"

Path redirect using explicit ordering
example.com/firstMatch/secondMatch -> about.example.com example.com/firstMatch/noMatch -> fallback or 404

example.com                                   3600 IN A      127.0.0.1
_redirect.example.com                         3600 IN TXT    "v=txtv0;from=/$1/$2/;type=path"
_redirect.secondmatch.firstmatch.example.com  3600 IN TXT    "v=txtv0;to=https://about.example.com/;type=host"

Path redirect using modified ordering
example.com/firstMatch/secondMatch -> about.example.com example.com/firstMatch/noMatch -> defaults or 404

example.com                                   3600 IN A      127.0.0.1
_redirect.example.com                         3600 IN TXT    "v=txtv0;from=/$2/$1/;type=path"
_redirect.firstmatch.secondmatch.example.com  3600 IN TXT    "v=txtv0;to=https://about.example.com/;type=host"

Path redirect using path record fallback for root/index
example.com/ -> root.example.com

example.com                                   3600 IN A      127.0.0.1
_redirect.example.com                         3600 IN TXT    "v=txtv0;from=/$1/$2;root=https://root.example.com;type=path"
_redirect.secondmatch.firstmatch.example.com  3600 IN TXT    "v=txtv0;to=https://about.example.com/;type=host"

Path redirect using path record fallback
example.com/firstMatch/noMatch -> fallback.example.com

example.com                                   3600 IN A      127.0.0.1
_redirect.example.com                         3600 IN TXT    "v=txtv0;to=https://fallback.example.com;type=path"

Path redirect using wildcard
example.com/firstMatch/secondMatch -> about.example.com example.com/firstMatch/randomString -> wildcard.example.com example.com/randomString/randomString -> full-wildcard.example.com

example.com                                   3600 IN A      127.0.0.1
_redirect.example.com                         3600 IN TXT    "v=txtv0;type=path"
_redirect.secondmatch.firstmatch.example.com  3600 IN TXT    "v=txtv0;to=https://about.example.com/;type=host"
_redirect._.firstmatch.example.com            3600 IN TXT    "v=txtv0;to=https://wildcard.example.com/;type=host"
_redirect._._.example.com                     3600 IN TXT    "v=txtv0;to=https://full-wildcard.example.com/;type=host"

Dockerv2

Currently Docker hub is not supported Only publicly available containers are currently supported

Dockerv2

Container vanity redirect
container.example.com/txtdirect -> gcr.io/some/container container.example.com/txtdirect:tag -> gcr.io/some/container:tag

container.example.com             3600 IN CNAME  txtdirect.example.com
_redirect.container.example.com   3600 IN TXT    "v=txtv0;https://gcr.io/some/container;type=dockerv2"

Container vanity redirect with enforced tag
container.example.com/txtdirect -> gcr.io/some/container:tag
container.example.com/txtdirect:123 -> gcr.io/some/container:tag

container.example.com             3600 IN CNAME  txtdirect.example.com
_redirect.container.example.com   3600 IN TXT    "v=txtv0;https://gcr.io/some/container:tag;type=dockerv2"

Full platform container vanity redirects
gcr.example.com/some/container -> gcr.io/some/container
gcr.example.com/some/container:tag -> gcr.io/some/container:tag
gcr.example.com/* -> gcr.io/*

gcr.example.com             3600 IN CNAME  txtdirect.example.com
_redirect.gcr.example.com   3600 IN TXT    "v=txtv0;https://gcr.io;type=dockerv2"

Gometa

Gometa

Go package vanity redirect pkg.example.com -> github.com/some/repo

pkg.example.com               3600 IN CNAME  txtdirect.example.com.
_redirect.pkg.example.com     3600 IN TXT    "v=txtv0;to=https://github.com/some/repo;type=gometa"