Step 1: Register for a Cloudflare Account
If you haven’t already registered for a Cloudflare account, you’ll need to start by creating one. Visit the Cloudflare website and locate the “Sign Up” option to initiate the account creation process. During this process, you’ll be required to provide essential information about your website, including your domain name and the IP address of your web server.
Step 2: Incorporate Your Domain into Cloudflare
After successfully setting up your Cloudflare account, the next step is to integrate your domain with the Cloudflare platform. To accomplish this, select “Add site” and input your domain name. Cloudflare will then conduct an automated scan of your DNS records and seamlessly transfer them into your newly established Cloudflare account.
Step 3: Create a page rule
Here’s a step-by-step guide on creating a page rule:
- Begin by accessing the “Page Rules” section within your Cloudflare dashboard.
- Next, click on the option labeled “Create Page Rule.”
- Within the “If URL matches” field, specify the URL pattern that necessitates redirection. For instance, if your aim is to redirect all traffic originating from “www.example.com” to “suppose.com,” input “www.example.com/*.”
- In the “Then the settings are” section, opt for “Forwarding URL.”
- Subsequently, insert the destination URL, which signifies the location to which you want the redirection to direct users. To continue with the example of redirecting traffic from “www.example.com” to “suppose.com,” enter “https://suppose.com/$1.”
- one more important things is set dns record. this dns rcord ip is fix. use exact same ip. “192.0.2.1”
- and save.
By following these steps, you can effortlessly set up a redirection rule using Cloudflare’s page rules feature.