hij
March 22, 2024, 7:46am
1
I want all pages, no matter the URL, to redirect to the homepage on the same site.
For example:
mydomain.com/about
mydomain.com/contact
mydomain.com/old-blog-post
…should all redirect to mydomain.com
Here’s what I’ve done so far (step by step in case anyone else finds it helpful):
Login to Cloudflare
Click on the domain to redirect
Rules > Redirect Rules
Click “Create rule”
Add a rule name (ex. Redirect to home)
I’m not sure what to choose from here.
Field?
Operator?
Value?
Type?
Preserve query string checked or unchecked?
Thanks!
sjr
March 22, 2024, 7:49am
3
See this recent thread for the same question which should give you what you need…
That’s because it redirects https://mydomain.com/ to itself.
I’ve not tested these, but this should give you something to work with. This uses Redirect Rules instead of Page Rules.
First, redirect the www to the apex, including all the path and parameters…
[Screenshot 2024-03-20 at 17.44.05 (2)]
Then redirect everything for the apex domain to the index page of the apex domain, unless the request is for the index page itself (to prevent “too many redirects ”) or contains the URL tracking par…
hij
March 22, 2024, 7:52am
4
I did see that thread but it seemed like a different question was being asked (i.e. www vs. non-www). Is the solution in my case the same?
sjr
March 22, 2024, 7:54am
5
Just ignore the www
redirect if you don’t need it.
The second screenshot in my solution there deals with redirecting all pages to the index page. The key is to avoid redirecting the index page to the index page and getting a “too many redirects ” error which is why /
needs to be excluded from any redirect match.
1 Like
hij
March 22, 2024, 7:57am
6
Ah OK. I will try. Thank you.
system
Closed
March 27, 2024, 10:21pm
7
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.