Page rule, how to not have trailing slash!?

In my page rule I want to forward my domain like this (no trailling slashes)
https://booqnly.comhttps://www.booqnly.com

But in the Cloudflare rules it always adds a trailing slash to the rule. So it ends up being:
https://booqnly.com/https://booqnly.com/

Which means if someone goes to the address without the slash the site fails.
I am trying to redirect all traffic to www.

Anyone have any information on how I can do this?

Sorry for the second batch of links i mean to have www in it:
https://booqnly.com/https://www.booqnly.com/

The trailing slash on any QDN itself is defined by the IETF RFC 3986 Section 3 and is optional/trivial if no path is given, but authority is present:

When authority is present, the path must either be empty or begin with a slash ("/") character.

So if no path, or an empty path is given it is the same as just a trailing slash. It should not show up in Chromes addressbar.

The trailing slash also is always present if you for example copy a URL with no path from Chromes addressbar, but not visible. If you copy that URL, it suddenly has that trailing slash, while normally when you are on a sites root path with a trailing slash, it is not getting shown. Therefore: it is there but Chrome hides it.

This is a different problem from the trailing slashes.

Lets go through the redirects from non-WWW to WWW.

Please set it up like this:

booqnly.com/* → (302) → https://www.booqnly.com/$1

After you could confirm it is working change the redirection code to 301.

If you are worried about, that your links e.g. “https://www.booqnly.com/contact” is also reachable under the same link with a trailing slash “https://www.booqnly.com/contact/” and you want the version without the trailing slash,

then you can do as following:

  1. set your links in your DOM to the version you want (without trailing slash)
  2. set the canonical according to the URLs you want:
    <link rel=canonical href=https://www.booqnly.com/contact>
  3. set up redirects
    3.1. with a PageRule https://www.booqnly.com/*/ → ( 302 ) → https://www.booqnly.com/$1
    3.2. if on Cloudflare Pages with the _headers file.
    3.3. with your local webserver config (nginx.conf or .htaccess) and redirect with some patternmatching.

Thanks for that information.

I already have the rule as you have described and double checked it again now:

If i go to the below it is still failing:
https://booqnly.com

I think you are wrong, you probably just don’t see the www by default as Chrome also hides this since some time, to make the URLs look cleaner.

Here, have a look:

I am not seeing this and I am trying different browsers.
Let me check on my mobile.

Right, so this works on my mobile when I am off wifi.

It looks like my router may have cached something and my devices on the wifi are getting dead pages, this is not the first time this has happened.

You have been a mega help and i really appreciate your time. Its 2:41am and its been one of those days.

Thank you :slight_smile:

Make sure you flush your DNS cache and restart your router & computer, this should fix that.

Make sure you use 1.1.1.1 as DNS resolver :slight_smile:
When things are cached, they are cached but if your DNS resolver is slow or overloaded they sometimes instruct devices to cache longer, which is bad. If you use CLoudflares DNS you are on the safe side.

You’re welcome!

1 Like

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