---
title: "Subdirectory"
description: "Serve your Contito site from a folder of your existing website, like www.example.com/docs, through a Cloudflare Worker."
url: "https://www.contito.com/docs/publishing/subdirectory"
published: "2026-11-16T06:04:37.917Z"
modified: "2026-11-16T06:04:37.917Z"
---

# Subdirectory

A subdirectory puts your Contito site inside your main website's address: `www.example.com/docs` or `www.example.com/blog`.

Your main site stays where it is. Contito serves only that folder.

## Why a subdirectory

Search engines see one website, so every visit and link to your docs or blog builds up your main domain.

A separate address like `docs.example.com` or `example.contito.org` counts as a site of its own.

Subdirectories are on Pro and Ultimate. On Starter, the

**Subdirectory**

section shows a lock and

**Upgrade to unlock**

.

## What you need

- A Cloudflare account. The free plan works.
- Your domain on Cloudflare, with its DNS record **Proxied** (the orange cloud in Cloudflare's DNS settings).

Contito connects through a **Cloudflare Worker**: a small piece of code that runs on Cloudflare and forwards every request for your folder to Contito.

Contito writes the code for you. You paste it.

## 1\. Enter the address

1. Open your site and click **Settings**.
2. Under **Hosting**, click **Subdirectory**.
3. Type your domain with the folder, like `www.example.com/docs`, and click **Save**.

![The Subdirectory section with www.example.com/docs typed and Save marked](https://www.contito.com/__asset/1281aog)

| \# | What it does |
| --- | --- |
| 1 | Your domain and folder. Lowercase only, in the form `example.com/docs`. |
| 2 | **Save**: shows the Worker setup. |

## 2\. Create the Worker

After saving, **Setup Cloudflare Worker** lists three values.

Click any box to copy its contents.

![The Subdirectory section after saving, with Worker Name, Code, Route and the Waiting for your Worker status marked](https://www.contito.com/__asset/wh2dj5)

| \# | What it is | Where it goes in Cloudflare |
| --- | --- | --- |
| 1 | **Worker Name**, like `www-example-com-docs-to-contito` | The name of the new Worker |
| 2 | **Code** | Replaces all of the Worker's starter code |
| 3 | **Route**, like `www.example.com/docs*` | The Worker's route, in the zone that covers your domain |
| 4 | Connection status | Shows **Connected** once it works |

In the Cloudflare dashboard:

1. Go to **Workers & Pages** and select **Create application**.
2. Select **Start with Hello World!**
3. Give it the **Worker Name** from Contito and click **Deploy**.
4. On the Worker's main page, click **Edit code** to open the code editor. Delete everything in it, paste the **Code** from Contito and click **Deploy**.
5. Back on the Worker's main page, click **Domains**, then **Add a route** under **Routes**.
6. On the custom domains and routes page, click **Add Route**. Pick the zone (your domain) and paste the **Route** from Contito, including the `*` at the end.

![Cloudflare's Deploy Hello World screen with the Worker name filled in](https://www.contito.com/__asset/ptk5x5)

| \# | What it does |
| --- | --- |
| 1 | **Worker name**: paste the **Worker Name** from Contito. |
| 2 | **Deploy**: creates the Worker. |

![Cloudflare's code editor with Contito's code pasted in and the Deploy button](https://www.contito.com/__asset/1bfbtzk)

| \# | What it does |
| --- | --- |
| 1 | The code: replace everything with the **Code** from Contito. Your copy has your own values on the first two lines. |
| 2 | **Deploy**: puts the new code live. |

![Cloudflare's Add Route dialog with the zone and the route from Contito filled in](https://www.contito.com/__asset/12886pf)

| \# | What it does |
| --- | --- |
| 1 | **Zone**: your domain. |
| 2 | **Route**: paste the **Route** from Contito, with the `*` at the end. |
| 3 | **Add Route**: saves it. |

The code holds a key that proves requests come from your Worker.

It gives no access to your Contito account or content, but anyone who has it can show your pages on their own domain, so don't share the code.

If it gets out, click **Regenerate key** and paste the new code into your Worker. The old key stops working.

## 3\. Connect

Open your new address, such as `www.example.com/docs`, in a browser.

The **Visit Website** button in Contito does the same.

The first visit through your Worker connects the site.

The status changes from **Waiting for your Worker** to **Connected**.

![The Subdirectory section showing www.example.com/docs with the Connected badge](https://www.contito.com/__asset/118ei7t)

Once connected, the setup steps fold away under **Show Cloudflare Worker setup**.

From then on, search engines index the site at your subdirectory.

## Status messages

| Status | Meaning |
| --- | --- |
| **Waiting for your Worker** | Contito is watching for the first visit through your Worker. |
| **No traffic from your Worker yet** | No visit arrived in the first few minutes. Check the Worker, visit the address, then click **Check again**. |
| **Connected** | Visits are coming through. The subdirectory is live. |

Your site stays reachable at its other addresses the whole time.

## Change or remove the subdirectory

Click **Edit** next to the address.

- To change it, type the new address and click **Save**. A new address gets a new key, so paste the new **Code** into your Worker and update its **Route**.
- To take it off, click **Remove**, then delete the Worker in Cloudflare.

## Troubleshooting

Check three things in Cloudflare: the Worker is deployed with Contito's code, its route matches the **Route** in Contito exactly (with the `*`), and your domain's DNS record is **Proxied**.

Then open your subdirectory address and click **Check again**.

The Worker isn't running on that address. Check the route's zone and pattern in the Worker's settings.

The subdirectory setup needs Cloudflare. Use a [Custom Domain](https://www.contito.com/publishing/custom-domain) like `docs.example.com` instead, which works with any DNS provider.

The main site's property covers it. One extra step points Google at the blog's sitemap. See [Google Search Console](https://www.contito.com/publishing/google-search-console).
