WWW redirect


#1

“Make sure that your website with www doesn’t redirect to the website without www. Try to choose a preferred domain name with www or without www. Search engines consider both websites as two different ones that’s why it is important to use 301 redirect from www.website.com to website.com or you can redirect from website.com to www.website.com. It is crucial to avoid duplicate content.”

I have just ran a Health Check to audit my site - my domain is www.infamystudio.com - How do i fix this issue!


#2

Add some lines to your .htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^infamystudio.com [NC]
RewriteRule ^(.*)$ htts://www.infamystudio.com/$1 [L,R=301]

This will make sure your domain always uses www


#3

If not Apache as @sdayman showed - you may try:

Cloudflare page rule:
URL Match .www.infamystudio.com/
Forwarding URL / 301 Permanent
Destination URL: http://infamystudio.com/$1

OR (for NGINX rewrite in custom.d)

server {
    listen 443; (or 80:)
    server_name  www.infamystudio.com;
    rewrite ^    http://infamystudio.com$request_uri? permanent;
         }

#4

I have two domains, I have set as above for both, one is working, but the other does not work and also no cloud icon (even grey or organ), Cloudflare looks like not stable.


#5

If it’s a CNAME, then some CNAME entries no longer get :orange: or :grey:. What’s your domain?


#6

Hi Sdayman,

My domain www.megapple.com is working very well, but www.smarthairdryers.com is not, both setting are same.

You wrote:

some CNAME entries no longer get :orange: or :grey:.

Do you mean CNAME @ & www no longer get grey or organ cloud, not allow user to switch them? thank you.


Max


#7

It would seem to me that those are CNAMES to a a site already hosted by Cloudflare. That being the case, you can’t Cloudflare (or un-Cloudflare) a Cloudflare site.

As for www.smarthairdryers.com not working, I suspect it’s because the CNAME origin site doesn’t recognize the www version as something it hosts. I would set up a page rule here (I think I mentioned this in another thread you posted in) to redirect *www.smarthairdryers.com* over to https://smarthairdryers.com


#8

Hi Sdayman,

Please see attached file, actually I have already a page rule (#1), even I
don’t think I have to add the second same page rule, but I added the second
page rule flowing your previous email, see below, but I DOES NOT WORK.
please check thank you so much.


#9

It seems it’s totally skipping your Cloudflare settings. As it’s already hosted at Cloudflare, maybe that’s just not an option.

In this case, I suggest you don’t use a CNAME for the www entry. Delete it and create an :orange: A record and use an IP address like 12.34.56.78 as a place holder. Then hopefully the Page Rule will kick in.


#10

Hi Sdayman,

You wrote:

As it’s already hosted at Cloudflare, maybe that’s just not an option.
What is my setting wrong???

Delete it and create an :orange: A record and use an IP address
Is it regular(standard) way??? I have many domains to add to CloudFlare, I need a standard way. which way (CNAME or A record) is correct?


Max.


#11

It was just a suggestion. You’re welcome to try something else.


#12

Hi Sdayman,

I give up, please tell me how to delete a website(domain) from CloudFlare, thank you!


#13

I will try to delete and add again.


#14

In case you need the steps, you can find them here. It’s presented as downgrading or deleting your account, but the instructions to delete a domain are the same: