Connect with us

Hi, what are you looking for?

Cloudflare

Tutorial: How To Redirect Pages With Cloudflare

How To Redirect Pages With Cloudflare

Many of us are required to implement page or website redirections to our websites once in a while and depending on your server type using your .htaccess file for redirections may not always be an option.

In this short guide, we will look at how you can create a single page or full website redirection using Cloudflare.

What is Cloudflare?

Cloudflare is a reverse proxy and CDN service that adds extra security and benefits to your website.

Some of the benefits of having your website behind Cloudflare include:

  • Site load speed
  • CDN – Distribute your content around the world so it’s closer to your visitors
  • Cache – When resources on your site are cached on Cloudflare’s data centers, it allows Cloudflare to send those resources to your visitors from a location closest to them.
  • Security
  • DDOS protection – When your website is behind Cloudflare, the DDOS attacks hit the Cloudflare servers instead of your website, allowing your website to remain online during the attack
  • Protection from SQL injection, spammers, and other online threats.
  • Free Cloudflare issued SSL certificates.

Cloudflare has a free basic plan which gives you access to 3 free page rules, which is what you will be using to create your first redirection. Additional page rules can also be purchased if required.

How to add a simple redirection

To create a redirection, log in to Cloudflare and navigate to the Page Rules section as displayed below.

Firstly, click on the Create Page Rule button. You will see a popup window asking you to insert the URL you wish to redirect.

In this example, we will use www.myoldwebsite.co.uk/page29.html.

OK, so we have added www.myoldwebsite.co.uk/page29.html. After you have added the URL you wish to redirect, below this click on the Add A Setting button. From the drop-down select Forwarding URL. Once selected, Cloudflare will now allow you to add the URL you wish to redirect to.

For example purposes, we are going to use www.myoldwebsite.co.uk/page30.html and select the status code 301 which will tell search engines this will be a permanent redirection. If you want to create a temporary redirection that will change in the near future select the status code 302. When finished click on Save and Deploy.

So what will happen exactly? Any visitor going to www.myoldwebsite.co.uk/page29.html will now be redirected to www.myoldwebsite.co.uk/page30.html, you have redirected your visitor to go from page29 to page30.

How to redirect an entire website

To redirect an old domain to a new domain that will keep an identical page structure you will need to make sure the old domain is added to Cloudflare. If you have yet not added the old domain name, add this to Cloudflare and then navigate to the page rules section and click on the Create Page Rule button. You will now see a popup window asking you to insert the URL you wish to redirect.

For example purposes, we want to redirect www.myoldwebsite.co.uk to www.mynewwebsite.com including all inner pages.

First, you add the old domain name, www.myoldwebsite.co.uk followed by a forward slash and an asterisk. It will look something like this: www.myoldwebsite.co.uk/*. * are called wildcards.

After you have added the old domain you wish to redirect, www.myoldwebsite.co.uk/*, below this click on the Add A Setting button. From the drop-down select Forwarding URL. Once selected, Cloudflare will now allow you to add the forwarding domain name you wish to redirect your old website to. In this field add your new domain name followed by a forward slash, dollar sign and the number one /$1. It should look something like this https://www.mynewwebsite.com/$1. Then select the status 301.

This will now redirect your entire website, the old domain to the new domain, including all of your inner pages.

There are many more page rule redirection examples over at the Cloudflare website.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Advertisement

More On The Net BLog

Business

As per our previous announcement, the Website Helper blog has now become thenet.blog. Here we have it, 36 approved UK business directories you can...

CSS

CSS media queries are an excellent way to deliver different styles to different devices. Here are CSS Media Queries for targeting your iPad in...

Web Hosting

GoDaddy has become a household brand, they are one of the biggest website hosting and domain name companies in the world. However, being the biggest does...

WordPress

Did you know that uninstalling WordPress plugins from the dashboard is simply not enough? Many website owners have most likely installed and tested several WordPress plugins but...

Business

Are you looking for alternatives to Peopleperhour.com to outsource your next project? For those that don’t know what Peopleperhour.com is, it’s an online freelance micro job...

SEO

Traffic is bad on the road. But it is a blessing on a website or blog- as long as your bandwidth can handle it....

WordPress

The problem faced by many WordPress websites using contact forms is spamming. It is frustrating and time-consuming to deal with. Spamming happens when malicious...

CSS

CSS media queries are an excellent way to deliver different styles to different devices. The rapid growth of mobile devices has made it a...

Advertisement