When Using Www Server Not Found, But When Using Non-Www It Works Fine

Hello,
Im having an issue with the website, whenever I use non-www it redirects and works fine, but when using www it doesnt redirect and the browser says server not found..
ex:
https://example.com- works good
https://www.example.com- doesnt work

I tried editing config.local.php:

$config['http_host'] = 'www.example.com';
$config['http_path'] = '';

$config['https_host'] = 'www.example.com';
$config['https_path'] = '';

but still it doesnt work

Did you try to set up www domain on the Administration -> Stores page?

Can you "ping" the www domain?

If not then you have a DNS issue. If so, you can always use the non-www domain in cs-cart (assuming you cleared the cache after changing in config.local.php) and provide a redirect in your .htaccess file. But you should be able to run your site as either www subdomain or not.

Check Nginx or apache config, your config not listen www

Can you "ping" the www domain?

If not then you have a DNS issue. If so, you can always use the non-www domain in cs-cart (assuming you cleared the cache after changing in config.local.php) and provide a redirect in your .htaccess file. But you should be able to run your site as either www subdomain or not.

Thanks, it was exactly a DNS issue!