How to Redirect a www URLs to a non-www

  1. Sign Up and create an account on Cloudflare.com
  2. Add a site by entering your URL and select the free plan
  3. Update your domain nameservers to point to CloudFlare
  4. Go to Rules and select Page Rules

There are different ways of accomplishing this but the most effective one I find is by using Cloudflare.com. You can create an account and they give you one free domain to configure.

1. Sign Up and create an account on Cloudflare.com by adding your email and a long password. Make sure that your password is long and has multiple non-alphanumeric characters. The minimum password is 8 but if you can do longer than 12, then that’s more secure.

You’ll get an email verification when you create account. Verify it so you can use Cloudflare properly.

2. Add your website by entering your URL and select the Free plan. For simple redirect, the free plan should be good enough for you. However, if you need more features than they offer then I recommend getting the higher plan.

Click Add site on the top right, then you’ll see the screen below. Enter your URL and click Add site button.

Accelerate and protect your site with Cloudflare

They’ll then show you all the current plan. The free plan is on the bottom of all the choices, so scroll down and look for Free then click Continue.

Cloudflare Free plan

3. Update your domain nameservers to point to CloudFlare

It will scan your domain for existing DNS settings and it’ll tell you to replace your DNS records with Cloudflare similar to the below.

Cloudflare DNS settings

Once you’ve replaced your DNS settings, it may take up to 24 hours for everything fully sync.

4. Go to Rules and select Page Rules

Cloudflare Rules

You are allowed to have 3 page rules under the free plan. Click Create Page Rule

Under URL(required), enter your domain followed by forward slash then asterisk. For example, with my domain, I put www.caninternationaltravel.com/*

Page rule cloudflare

Pick a setting, select Forwarding URL. For Select status code, pick 301 Permanent Redirect

Under Enter Destination URL, enter your domain followed by forward slash then $1. For example, on my domain, I’ll put caninternationatravel.com/$1

Then click Save and Deploy Page Rule. This rule would usually take effect in less than a minute.

That’s it! If you want to forward your non-www to www, do the reverse on step 4.

Posted

in

by