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.
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
- Open your site and click Settings.
- Under Hosting, click Subdirectory.
- Type your domain with the folder, like
www.example.com/docs, and click Save.
| # | 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.
| # | 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:
- Go to Workers & Pages and select Create application.
- Select Start with Hello World!
- Give it the Worker Name from Contito and click Deploy.
- 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.
- Back on the Worker's main page, click Domains, then Add a route under Routes.
- 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.
| # | What it does |
|---|---|
| 1 | Worker name: paste the Worker Name from Contito. |
| 2 | Deploy: creates the Worker. |
| # | 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. |
| # | 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.
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
It says No traffic from your Worker yet
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.
My main site shows up at /docs instead of Contito
The Worker isn't running on that address. Check the route's zone and pattern in the Worker's settings.
My domain isn't on Cloudflare
The subdirectory setup needs Cloudflare. Use a Custom Domain like docs.example.com instead, which works with any DNS provider.
How do I add the subdirectory to Google Search Console?
The main site's property covers it. One extra step points Google at the blog's sitemap. See Google Search Console .