Skip to main content
How to configure your URL with Cloudflare
Óscar Moreno avatar
Written by Óscar Moreno
Updated over 5 months ago

Video tutorial

Preface

If you have already configured your domain in your own infrastructure, you can handle the redirections by yourself, but it is a lot easier to manage it with Cloudflare. It will handle the HTTPS certificate for your domain and perform redirections with a simple page rule.

To configure your custom domain as a tracking domain for instasent, you just need to set up a 302 temporary redirection from yourdomain.com/* to inst.to/yourdomain.com/* in both HTTP & HTTPS protocols. By doing that, any access to yourdomain.com/any-link will be automatically redirected to our inst.to server (our shortener service) and we will take care of it automatically.

In this tutorial, we will configure one domain and one subdomain: yourdomain.com for general links and no.yourdomain.com for unsubscribes. If you do not want to use one for unsubscribes, just ignore the no.yourdomain.com instructions.

To begin with, you’ll need to purchase a domain from your preferred registrar (Domain.com, Godaddy, …) and create a Cloudflare account to manage your domain DNS records.

1. Add your domain to your Cloudflare account

  • If you haven’t already done it, access to your dashboard and click on Add a site

  • Once done, add yourdomain.com and click Continue

  • Select one plan (there is a free plan) and click Continue

  • You can leave the proposed DNS records by default and click Continue

2. Configure your domain to use Cloudflare

Once yourdomain.com has been added, you’ll be asked to configure the nameservers in your domain registrar to allow Cloudflare manage your DNS records. Follow Cloudflare instructions to complete the set-up.

3. Configure your domain DNS records to use Cloudflare as proxy

Access yourdomain.com DNS settings, and make sure that you have at least these DNS records configured like this, your domains must use the Cloudflare proxy.

This could take a few minutes to be applied, in the meantime, you can go on.

Make sure your domain SSL/TLS configuration is at least Flexible, to allow Cloudflare generate a HTTPS certificate for you:

4. Create a Cloudflare Page rule to perform the redirections

Now, we will create 2 redirections, one for yourdomain.com and another one for no.yourdomain.com

  • Go to Rules > Page Rules

  • Click on Create Page Rule

  • Configure it like this:

    https://yourdomain.com/*
    https://inst.to/yourdomain.com/$1
  • Now, create another one for no.yourdomain.com and configure it appropiately.

    https://no.yourdomain.com/*
    https://inst.to/yourdomain.com/$1
  • Once done, both rules should be shown, activate them if they’re not active:

4.B Redirect the homepage to your website

Lastly, it will be necessary to redirect the root of the domain you have registered to your main website.

5. Check redirection

Once your configuration is applied any access to yourdomain.com or no.yourdomain.com will be redirected automatically to our service, you can check it by trying it in your browser.

In both cases, you should end in the instasent.com page automatically. If it works, you can go to Instasent and validate your domains, they will check the redirection and activate the tracking domains if the configuration is correct.

If you’re a technical user and have access to a console with the curl command, you can check the location header of the response:

$ curl -I https://yourdomain.com/test
HTTP/2 302
date: Wed, 03 Jan 2024 10:06:54 GMT
location: https://inst.to/yourdomain.com/test
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
expires: Thu, 01 Jan 1970 00:00:01 GMT
server: cloudflare
$ curl -I https://no.yourdomain.com/test
HTTP/2 302
date: Wed, 03 Jan 2024 10:06:54 GMT
location: https://inst.to/no.yourdomain.com/test
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
expires: Thu, 01 Jan 1970 00:00:01 GMT
server: cloudflare

Did this answer your question?