www to ww1 redirect

In cloudflare, go to page rules -> Click Create Page rule -> enter the following (replace domain.com with your domain):
Code:
If URL matches: www.domain.com/*
Then the settings are:
First Field: Forwarding URL
Second Field: 301 - Permanent Redirect
Third Field: https://ww1.domain.com/$1
Click save.

Now Create a page rule again.

Code:
If URL matches: www.domain.com/
First Field: Forwarding URL
Second Field: 301 - Permanent Redirect
Third Field: https://ww1.domain.com/
Click save.


That should do it.

P.S.: Depending on your website CMS/Framework, you might also need to add the new site URL, e.g. ww1.domain.com
P.S. 2: You need to make sure that ww1.domain.com works. You will need an A record pointing ww1 to the IP (leave TTL as auto). You can do this from the DNS settings in your CF.
 
Last edited:
In cloudflare, go to page rules -> Click Create Page rule -> enter the following (replace domain.com with your domain):
Code:
If URL matches: www.domain.com/*
Then the settings are:
First Field: Forwarding URL
Second Field: 301 - Permanent Redirect
Third Field: https:ww1.domain.com/$1
Click save.
Code:
Now Create a page rule again.
If URL matches: www.domain.com/
First Field: Forwarding URL
Second Field: 301 - Permanent Redirect
Third Field: https:ww1.domain.com/
Click save.


That should do it.
is there anythink to do in cpanel or .htacces?

I use wordpress.
 
is there anythink to do in cpanel or .htacces?
Not if you used cloudflare name server. It can also be done through the htaccess/cpanel, but CF is much more cleaner. Do check my updated reply again. I have added a couple of catches there, and fixed the typo'd https scheme.

I use wordpress.
You will need to change your site URL from the settings/db, otherwise you will end up with "too many redirects" error probably.
 
doesn't google automatically know you did a link exchange? or is this their way of going around google's ban?
 
First create page rules.
Then add A record to ww1.domain.com in cf. then it will be done right?
 
You will need to change your site URL from the settings/db, otherwise you will end up with "too many redirects" error probably.

How I can change my site url from settings/db?

Thank you.
 
First create page rules.
Then add A record to ww1.domain.com in cf. then it will be done right?
First add A record with name:ww1 to your website IP. Let it propagate properly before attempting the page rules (generally takes a day). Once you have the record propagated, then attempt creating the page rules. Otherwise, your users will have downtime.

How I can change my site url from settings/db?

Thank you.
First of all, this should be done after the A record has propagated.
Go to your phpmyadmin. Go to the db -> go to wp_options table -> look for option_name = "siteurl" and "home" and replace them with the new url (make sure there is no trailing slashes after domain.com.. The sql might look like this:

Code:
UPDATE `wp_options` SET `option_value` = 'https://ww1.domain.com' WHERE `wp_options`.`option_name` = 'siteurl';
UPDATE `wp_options` SET `option_value` = 'https://ww1.domain.com' WHERE `wp_options`.`option_name` = 'home';

By the way, this can seriously break your site if you do not do it properly. So, beware, and do not blame me please. :p
 
Last edited:
Back
Top