WWW redirection

Like here https://support.cloudflare.com/ i have a sub-domain and it’s working but i do not want the error we can see here:
So i tried to write a forwarding url rule but it’s not working.

Thank you!

What’s the rule you tried? It should look something like:

forward to


  1. Make sure your web server is set up to respond to www.sub.example.com as an alias for sub.example.com
  2. Add this to .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.sub.example.com$ [NC]
RewriteRule ^(.*)$ https://sub.example.com/$1 [R=301,L]
  1. Make sure your Cloudflare DNS has a :orange: A record for www.sub that points to the same IP address as sub

I think that should do it.

1 Like

thank you for your answer.
i tried :
www.sub.example.com/ and *.sub.example.com/

forward to

But nothing!

  1. Yes i added alias, nothing!
  2. For .htaccess i can’t use because IIS server, so i should use Web.config :
    i try from http://htaccesstowebconfig.com/


rule name=“rule 1h” stopProcessing=“true”
match url=“^(.*)$” /
action type=“Rewrite” url=“/https://sub.example.com/{R:1}” /


  1. I did.


Ah ok i get it!
https://www.sub.example.com/ is not working but http://www.sub.example.com/ is working! (will redirect).
My website is all on https and i see under crypto

mywebsite.com, *.mywebsite.com (2 hosts)

  • shoud mean sub also?

What is the problem?

Sorry, it looks like the wildcards in my page rule example didn’t show up:

> *www.sub.example.com/*
> forward to
> https://sub.example.com/$2