Work around to make sub-subdomain useful on Cloudflare

As any seasoned webmaster may have known, Cloudflare’s free SSL certificate while convenient for most use cases, are very restrictive in edge cases. For example when you want to for your website, Cloudflare won’t work (only part is permitted).

What can you do? Other than paying cloudflare $10 / month and get a custom-made edge certificate?

You can set up URL forwarding rule like

  1. Log into your Cloudflare account.
  2. From the dropdown menu on the top left, select your domain.
  3. Click the Page Rules app in the top menu.
  4. When adding a new page rule, enable Forwarding.
  5. Enter the destination URL and select the forwarding type.

Forwarding examples:

Example forwarding to Google+:

Imagine you have a Google+ profile and you want to make it easy for anyone coming to get to simply by going to a URL like:



This pattern will match:

It will not match:  [extra directory before the +]  [no trailing slash]

Once you have  created the pattern that matches what you want, click the Forwarding toggle. That exposes a field where you can enter the address I want requests forwarded to.

If I enter that in the forwarding box and click the Add Rule button within a few seconds any requests that match the pattern I entered will automatically be forwarded with a 302 Redirect to the new URL. 

Advanced forwarding options:

If you use a basic redirect, such as forwarding the root domain to,  then you lose anything else in the URL. For example, you could setup the pattern:

And have it forward to:

But then if someone entered:

Then they’d be redirected to:

Not where you’d want them to go:

The solution is to use variables. Each wildcard corresponds to a variable when can be referenced in the forwarding address. The variables are represented by a $ followed by a number. To refer to the first wildcard you’d use $1, to refer to the second wildcard you’d use $2, and so on. To fix the forwarding from the root to www in the above example, you could use the same pattern:*

You’d then setup the following URL for traffic to forward to:$1

In this case, if someone went to:

They’d be redirected to:

Using this and set up a rule like


and forward it to


You can redirect it somewhere else or create a website for it

Leave a Reply

Your email address will not be published. Required fields are marked *