Htaccess redirect multiple www and non-www sites



Like many people with new websites, I tend to use

I’d like to redirect (with 301) multiple OLD sites (both www and non-www) to the above site


All to redirect (301) to the following:

I have asked for forum support but am a bit confused and I’ve searched high and low for an answer on google!

What clean code would you suggest?
Does this require 4 separate conditions?




Not sure if I understood you thoroughly, but if you add your other domains as additional domains in your app, then Cloudways will set up redirection to your main domain automatically.

Looks like there’s no need to add both www and non-www.

Tested the above with Wordpress, not sure about other platforms. But surely that redirection is not a feature of Wordpress.



Re Additional domains, cloudways documents says

‘In this option, any additional domain whether it is a sub-domain e.g. or an another domain e.g. for accessing the same website shall be added under Additional Domain option’

Cloudways -
(1) Does this work? In which case add both www and non-www
(2) Why does support not recommend this but htaccess instead? I’ve contacted supported around 3 times over this issue (different domain name changes) and they reply with htaccess.
Does the cloudways add domain do a 301 redirect?

(3) Please provide the htaccess code as well!

Many Thanks



Cloudways support - much appreciate a response please.