I resolved it after a deep study of my sites. In my server I have two sites: the first is written by me (a managerial software), and the second uses WordPress. I noticed out that the first site can be surfed with www and without-www, so I deduced that the problem wasn't the web server, but the CMS. After some researches on the web about this thing, I found out that WordPress (and also Magento) forces all the urls to be non-www (or the contrary, depending on WP version).
I fixed this problem with WP by adding this few line of code at the end of wp-config.php file, in the site's root:
$hostname = $_SERVER['SERVER_NAME'];
define('WP_SITEURL', 'http://' . $hostname);
define('WP_HOME', 'http://' . $hostname);
In Magento I can fix this problem with these methods: https://docs.nexcess.net/article/changing-magento-base-urls.html
Ps: if you want to test the non-CMS site's urls are http://www.merlinimediazioni.com and http://merlinimediazioni.com ; the CMS site's urls are http://www.mattiamerlini.it and http://mattiamerlini.it . When you load one of these urls you can notice that if you have inserted www.mattiamerlini.it the url remain with www, and viceversa for non-www.
Thank you for your time and help
Have a nice weekend
I fixed this problem with WP by adding this few line of code at the end of wp-config.php file, in the site's root:
$hostname = $_SERVER['SERVER_NAME'];
define('WP_SITEURL', 'http://' . $hostname);
define('WP_HOME', 'http://' . $hostname);
In Magento I can fix this problem with these methods: https://docs.nexcess.net/article/changing-magento-base-urls.html
Ps: if you want to test the non-CMS site's urls are http://www.merlinimediazioni.com and http://merlinimediazioni.com ; the CMS site's urls are http://www.mattiamerlini.it and http://mattiamerlini.it . When you load one of these urls you can notice that if you have inserted www.mattiamerlini.it the url remain with www, and viceversa for non-www.
Thank you for your time and help
Have a nice weekend