How to connect a subdirectory to my account?

Hi guys,

I’d like to know how I can add and set up a subdirectory to my Cloudflare account?

My main domain is, and directory is I read a few articles on connecting your subdomain, but nothing about directories.

Do you have any recommendations when it comes to settings after I’ve added it?


That’s configured at the server. Cloudflare proxies Hostnames (domains and subdomains).

  • As far as subdirectories go & using page rules specific to subdirectories, you’ve two basic configs to use - which is up to you as well as your account type/number of page rules.
  • For a free account with no extra page rules, and assuming you’re using a named domain vs a .www subdomain setup, you’ll want to use the following example as page rule #1:
    ** Forwarding URL (Status Code: 301 - Permanent Redirect, Url:$1)
  • That is assuming you’re not using any subdomains at all, but at the same time it covers forwarding the www. subdomain to your naked domain while retaining any requested subdirectory.
  • Now, insofar as each separate subdirectory is concerned, depending on personal preference as well as security requirements, caching preferences, etc., it’s best to have more than the 3 page rules that come with a free account. Why? So that you have fine-grain control over each subdirectory your site serves.
  • Examples (from one of my own sites with the domain changed to
  1. Security Level: High, Cache Level: Cache Everything, Cache Deception Armor: On, Origin Cache Control: Off
  2. Browser Cache TTL: 16 days, Cache Level: Cache Everything, Edge Cache TTL: a month, Cache Deception Armor: On, Origin Cache Control: Off
  • There are obviously more configs from which to choose; the examples I’ve given are specific to my own site/s. However, I hope this helps to get you started. Also, as always, the best way to learn is to experience, so by testing various configs for your site you’ll become proficient in a short matter of time.

Good luck!

This topic was automatically closed after 31 days. New replies are no longer allowed.