Page Rules redirect question

Answer these questions to help the Community help you get started.

What is the domain name?

Have you searched for an answer?

Please share your search results url:

Discourse is telling me I can’t share any links or URLs.

When you tested your domain using the Cloudflare Diagnostic Center, what were the results?

It just redirects to the support page.

Describe the issue you are having:

I’m serving a site from R2.

R2 doesn’t support “default pages”.

So URIs for:
hXXps://domain.tld/foo/bar/baz/bat/, etc.
… all return a 404 Not Found because the index.html file in that directory is not being served.

Having a bit of difficulty trying to figure out the Page Rule that will redirect all requests for / and / that are n+ sub-levels deep to / + index.html.

What error message or number are you receiving?


What steps have you taken to resolve the issue?

I tried wildcard page rules but those didn’t work.

I tried a page rule with $1 but that only matched the top most level.

Was the site working with SSL prior to adding it to Cloudflare?


What are the steps to reproduce the error:


Have you tried from another browser and/or incognito mode?


You’re right, Cloudflare R2 does not serve the index.html on paths ending with /. For serving static sites, Cloudflare Pages (which does serve index.html on paths ending with /) might be a better choice.

However, if you really want to use Cloudflare R2, you can create a URL Rewrite Transform Rule that appends index.html when the path ends with /.

1 Like

Perfect! Thank you!

(I’m using Hugo to create a static website and using s3cmd to upload it to R2 so Cloudflare Pages didn’t seem like it would apply.)

But doing a URL Rewrite Transform Rule worked flawlessly.

Thank you very much!

Hopefully this will help others too looking to do something similar.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.