URL redirection can be really useful in the following cases:
You've changed your web hosting provider and don't want to lose your ranking in the search results
You've changed your website's domain name, and you don't want to lose your current client base
You have several similar domain names and want to increase traffic (e.g.,
facebook.com
andfb.com
)Your domain is spelled and pronounced differently (e.g.,
cookie.com
andkuki.com
).
Let's say you want to redirect a domain-A to a domain-B:
1. Create a free Cloudflare account
Signing up at Cloudflare is easy and takes only a few minutes.
Once you create your Cloudflare account, you can proceed with adding your website (domain name) there.
2. Add your website to Cloudflare
1. In your Cloudflare dashboard, click Add Site:
2. Insert your domain name (the one you want to redirect to another domain):
3. Select your plan – we recommend choosing the Free version – and click Continue. The free plan comes with all the needed basic features to protect your website from online threats and enhance its loading speed.
4. In the Review your DNS step, click Continue.
Now, you will need to point your domain to Cloudflare by updating your domain's name servers. Don't worry, it's simple!
3. Point your domain name to Cloudflare
In the step Change your nameservers, you will see detailed instructions – follow them. In short, you'll need to log into your domain provider's website, find your domain's nameservers and replace them with the custom Cloudflare nameservers:
1. Log in to your domain provider's website. If your domain is registered at Zyro, log into your Zyro account.
2. Find your domain's nameservers settings; you'll need to specify custom nameservers. If your domain's at Zyro, follow these steps.
3. Remove the current nameservers and insert the ones given by Cloudflare.
4. Go back to the Cloudflare page and press Done, check nameservers. If you're then presented with the Quick Start Guide, you may click Finish later:
Note that it may take up to 24 hours for the DNS changes to propagate worldwide. Once the nameservers update is complete, you will receive an email confirmation from Cloudflare.
4. Add required DNS records
To execute a redirect from domain-A to a domain-B, the source domain (domain-A) needs to be pointed to any IP address. You can point it to a dummy IP address: 192.0.2.1
.
At Cloudflare, go to the DNS section and make sure that there are similar records for your domain:
If there are no such DNS records there, click Add record and create two A records (one for www, one for your root domain) as in the image above.
5. Configure the HTTPS settings
Hypertext Transfer Protocol Secure (HTTPS) secures website data through an SSL certificate.
In Cloudflare, go to the SSL/TLS → Overview, and make sure that the Full encryption mode is enabled:
6. Set up a redirect
Once your domain fully connects to Cloudflare (it may take up to 24 hours), you can finally create a domain redirection.
1. Go to Rules → Page Rules and click Create Page Rule:
2. Enter the URL that you want to redirect to another URL.
3. Choose the setting Forwarding URL, and its type: 301 (Permanent Redirect) or 302 (Temporary Redirect).
4. Insert the destination URL, the one you want to redirect to.
5. To finish, click Save and deploy. Repeat the same with all URLs you want to redirect:
And that's it! The page rule goes live immediately 🎉