You might need to move your website every once in a while. This could be due to a redesign, rebranding, marketing landing page A/B testing, domain change, and traffic redirection to updated content.
In this article, we will cover the steps necessary to Create a Wildcard Redirect in Cloudflare. Creating a Wildcard Redirect will not require much knowledge. What you need to understand is to implement the rules correctly in your Cloudflare Account.
What is Wildcard Redirect?
Wildcard redirect is very helpful when you want to change the names of URLs in a directory or send users from any URL in a directory to another place.With the help of wildcard redirect, you can redirect users from i.e "example.com/link"
to "example.com/links"
.
You can also use it to redirect users who are typing random urls on your website to your homepage or any other URL. i.e "abc.page.link"
to "abc.com/link"
. Let's begin!
How to Set up Wildcard Redirect Rules?
Step 1: Log in to your Cloudflare Accountand choose your domain.
Step 2: Go to Rules.
Step 3: Click Create Page Rule under Page Rules tab.
Step 4: The Create Page Rule for your_domain
dialog opens.
Step 5: Under If the URL matches, enter the URL or URL pattern that should match the rule. i.e https://www.example.com/link/*
Step 6: Under Then the settings are, click Add a Setting.
Step 7: Select an option from the dropdown menu. For this tutorial we select Forwording URL.
Step 8: Next click Select status code, then select an option from the menu according to you need.
Step 9: Go to Enter destination URLdirectory, where you want the users to get redirected. i.e https://example.page.link/$1
Step 10: From the Order dropdown, specify the desired order: First, Last, or Custom, i.e select First
Step 11: Choose a Save option:
- Save as Draft to save the rule and leave it disabled. Note that disabled rules count towards the number of rules allowed for your domain.
- Save and Deploy to save the rule and enable it immediately.
How to Edit existing page rules?
Editing the wildcard redirect page rule in Cloudflare is not a rocket science.
Step 1: Log in to your Cloudflare Accountand select your Domain.
Step 2: Select the domain where you want to edit your page rule.Click Rules.
Step 3: In the Page Rules tab, locate the rule to edit.
Step 4: Proceed to make the necessary changes, as follows:
- To enable or disable a rule, click theOn/Off toggle.
- To modify the URL pattern, settings, or order, click the Edit button (wrench icon). In the dialog, enter the information you want to change.
How to Delete a Cloudflare Page Rule?
Step 1: Log in to your Cloudflare Accountand select your Domain. Select the domain where you want to edit your page rule.
Step 2: Click Rules.
Step 3: In the Page Rules tab, locate the rule to edit.
Step 4: Click the Delete button (wrench icon) and confirm the deletion when prompted.
Final Words
Leave a comment below if you have any questions about the Cloudflare Wildcard Redirect, tutorial.
If you think this article was helpful, please share it with your friends and other people. I'm grateful.
Make sure to bookmark our website by pressing CTRL+D
, as I will be sharing more amazing posts and codes similar to this one in future entries.
Thanks for reading: How to Create Wildcard Redirect in Cloudflare, Sorry, my English is bad:)