How to Setup Wildcard 301 Free URL Forwarding With Cloudflare

As some of you may know, this woorkup blog used to be under the wpseer branding until I migrated it over. I acquired wpseer a while back and made the shift to a new name because this is not just a WordPress site, but targeted to many other types of marketers. One issue I ran into was that while I had wpseer.com up, I had migrated it to HTTPS. So when I went move to woorkup branding, I had backlinks on both the HTTP and HTTPS versions. The problem was, I didn’t want to keep that WordPress site up and running just for the 301 redirects. And that is where Cloudflare came to the rescue with free URL forwarding.

Follow the tutorial below on how setup free URL forwarding with Cloudflare, along with 301 wildcard redirects.

Free URL Forwarding With Cloudflare

A while back I wrote a post about how to implement wildcard 301 URL forwarding with your domain registrar. However, the problem with that is, you can only do the HTTP version because doing URL forwarding from HTTPS requires having an SSL certificate installed. The great news is, you can do this with Cloudflare, even if there is no hosting connected it. And what do I mean by a wildcard redirect? It means for example that any traffic that tries to access domain1.com/blog redirects to domain2.com/blog. So in this instance, the following 301 redirects work:

  • http://wpseer.com/ 301 redirects to https://woorkup.com
  • https://wpseer.com/ 301 redirects to https://woorkup.com
  • http://wpseer.com/* 301 redirects to https://woorkup.com/*
  • https://wpseer.com/* 301 redirects to https://woorkup.com/*

This ensures that all the backlinks on both the HTTP and HTTPS versions don’t break for SEO purposes. Remember, 301 redirects are needed to pass link juice. And this of course assumes that your URL structure remains the same on the new domain.

Step 1

First you will need to add your domain that you want to redirect to Cloudflare. Simply signup for a free account and click on “+ Add Site.” Input your domain and click on “Begin Scan.” It may take a minute or two and then click on “Continue Setup.”

add site cloudflare

Step 2

By default the scan will show you the records of your current domain. You can simply delete everything and simply leave an A name record for both the www version and your primary domain. The IP address is simply the one provided by your current domain registrar. In this case, it was just NameCheap. Then click on “Continue.”

cloudflare dns records

Step 3

Select the Cloudflare free plan and click “Continue.”

cloudflare free

Step 4

You will then need to point your current domain to the Cloudflare nameservers. You can do this at your domain registrar.

cloudflare change nameservers

Step 5

Under the Crypto menu, select “Flexible” SSL. You will need this to ensure that redirects over HTTPS also work.

cloudflare flexible ssl

This enables a universal SSL certificate on both *.domain.com and domain.com. This uses SNI and works on the following browsers:

Desktop Browsers installed on Windows Vista or OS X 10.6 or later:

  • Internet Explorer 7
  • Firefox 2
  • Opera 8 (with TLS 1.1 enabled)
  • Google Chrome v5.0.342.0
  • Safari 2.1

Mobile Browsers

  • Mobile Safari for iOS 4.0
  • Android 3.0 (Honeycomb) and later
  • Windows Phone 7

Step 6

Under the Page Rules menu click on “Create Page Rule.”

cloudflare create page rule

Step 7

You will then want to enter the following pattern:

https://yourdomain.com/*

Select “Forwarding URL” and “301 – Permanent Redirect” for the settings, and input the following rule:

https://yourdomain.com/$1/

The /$1/ enables the wildcard part to function. Then click on “Save and Deploy.”

301 redirect wildcard cloudflare

The single rule above makes the following work:

  • http://wpseer.com/ 301 redirects to https://woorkup.com
  • https://wpseer.com/ 301 redirects to https://woorkup.com
  • http://wpseer.com/* 301 redirects to https://woorkup.com/*
  • https://wpseer.com/* 301 redirects to https://woorkup.com/*

And that is it! You can now ditch the hosting plan on your old domain and your wildcard 301 redirects will now be in place forever, pointing to your new domain. You can easily test different variations with HTTP Status Code Checker.

301 redirect cloudflare

Hopefully this tutorial on free URL forwarding will help you on your next migration!

GET MORE STUFF LIKE THIS

Marketing, WordPress, Blogging Tips, SEO and Reviews, once a week.

Thank you for subscribing.

Something went wrong.

7 Comments

  1. LiewCF December 29, 2016
  2. UpDoz December 31, 2016
  3. Chris Schwartze January 7, 2017
    • Brian Jackson January 8, 2017
  4. Adjie Purbojati March 5, 2017

Add Comment

58 Shares
Tweet
Share
Share
Buffer